perl question

perl question

Page 1 of 1

2 Replies - 1282 Views - Last Post: 01 November 2008 - 07:53 PM

#1 mikehi   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 31-October 08

perl question

Post icon  Posted 31 October 2008 - 07:13 PM

This is my first time posting to this site so please bear with me and tell me if I am doing anything incorrectly. I am not quite sure how to ask my question:

I have a site, with 2 different formats (separate cgi scripts) that can view the very same parameters, dat files, etc, but display the information somewhat differently. It give users a choice of formats.

Users can change from one to the other but whenever the change is made, they are referred back to the home page only and they sort of have to start over.

I'd like the change to happen so that one can switch from one script to the other but keep the same parameter, the same page that one is on, without having to start over from the home page.

For example, if I am in script1 on, say, page 3 of the site, and want to switch to script2, I can do so but will end up back on the home page. I want to be able to go from script1, page 3 to script2 page 3 without having to star over from the home page..

So I'd like to be able to go from:
http://www.mydomain....ript1.cgi?page3

to:
http://www.mydomain....ript2.cgi?page3

Since there are dozen of different pages, and parameter are always changing, I need a code that can capture the URL I am currently on and then change the script number while keeping the same page# and reload the page in the new script's format.

Does this make sense? Is there a way to do this using perl?

This post has been edited by mikehi: 31 October 2008 - 07:14 PM


Is This A Good Question/Topic? 0
  • +

Replies To: perl question

#2 GWatt   User is offline

  • member icon

Reputation: 309
  • View blog
  • Posts: 3,106
  • Joined: 01-December 05

Re: perl question

Posted 01 November 2008 - 05:48 PM

If you don't have data sent via POST you can just take the QUERY_STRING environment variable and append it to the url
$url .= "&$ENV{'QUERY_STRING'}"


Was This Post Helpful? 0
  • +
  • -

#3 KevinADC   User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: perl question

Posted 01 November 2008 - 07:53 PM

View PostGWatt, on 1 Nov, 2008 - 05:48 PM, said:

If you don't have data sent via POST you can just take the QUERY_STRING environment variable and append it to the url
$url .= "&$ENV{'QUERY_STRING'}"



Sure you can capture the query string like that, but its not going to do anything. He could do this inside his perl scripts or possibly do it using mod_rewrite. mod_rewrite might be the easier of the two options.

The best solution is to have one perl script.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1