Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

In reply to CGI from another script by rsiedl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-24 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found