Jun 24, 2012, 6:19 PM
Thanks for the replies so far. I appreciate your time very much.
Re: [wickedxter] Using require to redirect a cgi script
I use to have a single cgi script that managed two different types of logins. But now I need to separate out that into two separate cgi files. So I have two .cgi files that have basically the same set of function calls.
When the user logs in, it calls the wrapper script, signon.cgi. WHat I need to do is now decide which script to call. signon1.cgi or singon2.cgi.
I currently use require. Based on the cgi params passed into the wrapper, I require signone1.cgi or signon2.cgi.
This is for a fairly old legacy system before Session was even around and is using an older perl. So I'm limited to what I can do.
I am using require and it works. If I thought this would be a problem I probably would write the wrapper signon.cgi to do the following.
1. Generate html with a form and loop through all passed in params. The form will have all hidden text fields. Then the generated html will send a post in the <body onload="signon1.cgi or signon2.cgi">. So it is the long archaic way to re-send parameters between cgi calls. I am not even sure Session is even on these systems.
What I didn't understand was why the require worked. The wrapper script creates a CGI object and processes the params. Then it requires signon1.cgi or signon2.cgi. These are stand-alone scripts, with their own set of headers and create their own cgi object to process params. I was surprised that using require seemed to include the file in it's own namespace. This is just from my lack of indepth knowledge of require. I will study that in the meantime.
(This post was edited by srhadden on Jun 24, 2012, 6:22 PM)