Jan 5, 2016, 2:10 PM
Post #1 of 3
Hello, I'm not a perl programmer in anyway but i've got to do some conversion to an existing very large perl script that is currently running on a linux server. I'm pretty much stuck and would greatly greatly appreciate some help as I try to do this. Was very glad to find this forum.
Passing parameters to a perl-cgi script using a url
I'll try to explain this the best I can. I hope it makes sense.
As I mentioned this perl script I need to change is very long but has many comments and many different options to set for testing etc. It does a lot of things that I really don't need to change. I just need to get it to run on a different server by calling in a different way and with it using a different database.
The main changes I need are 1) The way the script is being called and 2) connecting to a different oracle database than it is currently using.
Currently the way the perl script gets called is that there is a screen when the user clicks a button It makes a call to a small shell script. The shell script contains a few lines that set up environmentals - path, perl5lib, oracle_sid, oracle_home, ld_library_path etc. After defining this environmentals the last line of the shell script does the actual call to the perl script which is running on the server. This line is:
/opt/software/pcs/fame_3.0/perl/sched tran_id $1
sched.pl is the name of the perl script and tran_id $1 is just passing
a parameter to the script , the parameter name is tran_id and the value is in $1, so it would actually look like this:
/opt/software/pcs/fame_3.0/perl/sched tran_id 3997
(the value of tran_id is 3997)
In the perl script ARGV handles the paramater/argument being passed.
Now the new way I need to call it is to call it using a url which opens a web browser and passes the parameter to the perl script. The perl script will be called as a .cgi Since i'm not calling a shell script first that sets up the environmentals i've defined them at the top of the perl script.
My question for now is how do I accept the parameter I am passing in the url, into the cgi/perl script. I was thinking it would still go into the ARGV array but I read somewhere that ARGV was for command line arguments only and would not work with parameters passed in a url. So, i'm not sure how to accept the parameter being passed in the url into the cgi script. The url will look like this.
Can someone please tell me how I can access this parameter in the cgi script? Would really appreciate any help I can get.