Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: CGI from another script

by jeffa (Bishop)
on Sep 02, 2005 at 13:50 UTC ( [id://488648]=note: print w/replies, xml ) Need Help??


in reply to CGI from another script

You have to use the magic ampersand:

`perl some_script.cgi 'blah=foo&larh=bar'`;

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: CGI from another script
by rsiedl (Friar) on Sep 02, 2005 at 13:57 UTC
    i wrote a couple of test scripts before posting and they seemed to work fine without the ampersand...
    tmp.pl
    #!/usr/bin/perl use strict; use warnings; my $id = 1; my $auth_id = 150; my $blah = `perl ./tmp.cgi id=$id auth_id=$auth_id draw=1 raw=raw`; print $blah, "\n"; exit;
    tmp.cgi
    #!/usr/bin/perl use strict; use warnings; use CGI qw(:all); my $q = new CGI; my $id = $q->param("id"); my $auth_id = $q->param("auth_id"); my $draw = $q->param("draw"); my $raw = $q->param("raw"); print $id, "\n"; print $auth_id, "\n"; print $draw, "\n"; print $raw, "\n"; exit;
    I wonder if it is because the first one was a perl script run from the command line rather than a cgi from the browser?
    Update: I just updated my original script and the amp's arent helping either. But they do still work in the test script... hmmmm
      ... or because the quoting (or OS) is different? Compare jeffa's -- which adds single quotes (which the op lacks) around the var list as well as the ampersand.
        yeah, i saw that and also tried it with quotes. doesnt seem to make a difference.
        I've investigated a bit more and it looks like the .cgi script i am calling from the first script, is getting the vars from the first scripts vars...
        Just about to do an update on my orig post for more info...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://488648]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-03-29 00:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found