CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Using require to redirect a cgi script: Edit Log



srhadden
Novice

Jun 22, 2012, 3:39 PM


Views: 2008
Using require to redirect a cgi script

I have a situation where I am calling a single signon.cgi script with information posted to it.

What I need to do is, if the parameter is X, I need to execute custom_signon1.cgi, if the param passed is Y, I need to execute custom_signon2.cgi.

I've found that if I change custom_singon1.cgi to custom_signon1.pm, I can check the param, and then do:

if(x) {
require "custom_signon1.pm"
}
elsif(y) {
require "custom_signon2.pm
}

What happens seems to be exactly what I want. the CGI parms are still part of the namespace, so the modules I include can re-read the cgi vars and use them.

I would like some opinions on this method, I dunno if there is a better way. The brute force way is to simply generate an html form with hidden params and then post to the file I want to redirect to.


(This post was edited by srhadden on Jun 22, 2012, 3:40 PM)


Edit Log:
Post edited by srhadden (Novice) on Jun 22, 2012, 3:40 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives