einerwitzen has asked for the wisdom of the Perl Monks concerning the following question:

A simple question probably, but I can't find an answer anywhere :)

I have an html page and I am trying to pull in a script using an SSI
<!--#exec cmd="./test.cgi" -->

Now what i want to do is be able to send a variable with that, now it doesn't work bt just to show you what i'm aiming for i thought something like this:
<!--#exec cmd="test.cgi?var=hi" -->

But that isn't working obviously, which is why I'm asking. How can i do this?

thanks in advance for any input!

Replies are listed 'Best First'.
•Re: SSI-ing to a script WITH A VARIABLE?
by merlyn (Sage) on Apr 12, 2002 at 22:50 UTC
Re: SSI-ing to a script WITH A VARIABLE?
by JayBonci (Curate) on Apr 12, 2002 at 22:51 UTC
    This is somewhat off-topic, but from the apache SSI documentation, you can use
    <!-- #include virtual="test.cgi?foo=bar" -->
    This will translate the file to the actual file, and pass in the query string as additional parameters. Good luck. Why aren't you calling the script directly from the web browser? use CGI or die; is a great place to start.

        --jb
Re: SSI-ing to a script WITH A VARIABLE?
by Hero Zzyzzx (Curate) on Apr 12, 2002 at 22:51 UTC

    I don't believe you can.

    What you CAN do is send the information as PATH_INFO, by putting it in the SSI directive thusly-

    <!--#exec cmd="/cgi-bin/test.cgi/hi" -->
    and then picking it up in your script via the PATH_INFO environment variable- either
    my $var=$ENV{PATH_INFO};
    or
    use CGI; my $q=CGI->new(); my $var=$q->path_info();
    either way, you'll have "/hi" in $var.

    Cheers!

    Update
    While I'm pretty sure my version would work, merlyn's answer is (<sarcasm>surprisingly</sarcasm>) the more appropriate one.

    Update #2:
    Umm. . .You can call off the dogs. The "sarcasm" is because merlyn is right, and I'm not surprised.

    -Any sufficiently advanced technology is
    indistinguishable from doubletalk.