Hi Monks,
I'm attempting to call a .cgi script from another one of my scripts and for some reason it is only recognising the first var I pass to it.
i.e.
`perl some_script.cgi blah=foo larh=bar`;
and
some_script.cgi is only seeing the results from var
blah
Anyone got any ideas?
Cheers,
Reagen
Update:
I've done a bit more investigating and it appears that the script being called from the original script is using the var's from that original script.
i.e.
some_script.cgi?blah=foo&larh=bar will pass the vars blah and larh onto the script that some_script.cgi calls...
make sense?
I havent been able to work out how to prevent that and specify my own when I call the script. Anyone?
Here's some code that explains more clearly than I:
script1.cgi
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw(:all);
print header;
my $blah = `perl ./tmp.cgi 'var1=one&var2=two'`;
print "<pre>", $blah, "</pre>\n";
exit;
script2.cgi
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw(:all);
my $q = new CGI;
my $var1 = $q->param("var1");
my $var2 = $q->param("var2");
print $var1, "\n";
print $var2, "\n";
exit;
The only way I can get var1 and var2 to print is by calling
script1.cgi?var1=one&var2=two even though I define that in script1 where I call script2.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.