Is there a way to send arguments to a perl script?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
BridgeScore
Newbie
Posts: 14
Joined: Sun Feb 26, 2006 3:55 pm
Location: Florida
Contact:

Is there a way to send arguments to a perl script?

Post by BridgeScore » Fri Mar 10, 2006 4:48 am

I have a perl script that generates a web page. I would like to send an argument with the URL. Is this possible?

http://www.mywebsite.com/myscript.pl argument

I have tried HTTPrequest. I don't think perl uses value pairs just an argument whould would be ARGV[0] etc...

Perhaps something in VBSCRIPT??

Scripts are running on an Apache linux server.
I have root permission.

Thanks
___________________________________
Writing the program is easy
finishing the program is hard

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Mar 10, 2006 4:54 am

This is a bit off the reservation but you can definitely do that with php like:

http://www.yoururl.com/yourfile.php?variable=value

BridgeScore
Newbie
Posts: 14
Joined: Sun Feb 26, 2006 3:55 pm
Location: Florida
Contact:

Post by BridgeScore » Fri Mar 10, 2006 5:21 am

Yes I know that. But the script is perl not php. It is rather large to rewrite.
___________________________________
Writing the program is easy
finishing the program is hard

BridgeScore
Newbie
Posts: 14
Joined: Sun Feb 26, 2006 3:55 pm
Location: Florida
Contact:

Post by BridgeScore » Sat Mar 11, 2006 1:58 am

There is one way. Not a great way but a way.
place the following code in your perl file and make
sure that it is in an executable
directory or home directory and that it is executable.
chmod 755
============================================
open( FORMFILE, " to upload the file to the server place in directory
where you told the perl file to look above.

Then when the perl file runs it will grab the
value pairs from the formlog.txt file.
___________________________________
Writing the program is easy
finishing the program is hard

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Mar 11, 2006 3:02 am


BridgeScore
Newbie
Posts: 14
Joined: Sun Feb 26, 2006 3:55 pm
Location: Florida
Contact:

Post by BridgeScore » Sat Mar 11, 2006 4:11 am

Thank you Me_again

I had tried that and it did not work for me. Your URL http://www.unix.org.ua/orelly/perl/learn32/ch18_04.htm pointed me in the right direction.

I had:

use CGI qw(:standard);

I needed to add:

use CGI qw(param);

It works great now. Thanks for the research
___________________________________
Writing the program is easy
finishing the program is hard

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts