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

I have a perl script that I use via SSI using the EXEC CGI code.
<!--#exec cgi="day.pl?view=all" -->
It worked until I added the param view=all on there. How can I load a CGI script with a param?

Replies are listed 'Best First'.
Re: how to exec a CGI file with params?
by davidrw (Prior) on Jun 17, 2006 at 20:17 UTC
    I think you can (should) use include virtual instead of exec cgi...

    From the apache mod_include docs:
    If the specified URL is a CGI program, the program will be executed an +d its output inserted in place of the directive in the parsed file. Y +ou may include a query string in a CGI url: <!--#include virtual="/cgi-bin/example.cgi?argument=value" --> include virtual should be used in preference to exec cgi to include th +e output of CGI programs into an HTML document.
      Hi.

      I can't get it to work yet. For the SSI I am using   <!--#include virtual="day.pl?show=all" --> Inside my day.pl script (it's loading without error now, but it's loading the main script, it's not catching on the param "show".

      my $show = url_param("show"); my $show1 = param("show"); . . if ($show ne "all" || $show1 ne "all") {
      I did show and show1, incase it wasn't passing as a URL param. Neither of them catch. Any idea why?
        To be able to answer your question, we need to see more of your CGI-program.

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: how to exec a CGI file with params?
by lima1 (Curate) on Jun 17, 2006 at 20:17 UTC
    Maybe
    <!--#include virtual="day.pl?view=all"-->
    ?
Re: how to exec a CGI file with params?
by freakingwildchild (Scribe) on Jun 18, 2006 at 00:42 UTC
    To get more about what your server gives/takes as parameters ; which parameters you can use through $ENV and param as shown above you can use this little perl script.
    #!/usr/bin/perl print "Content-type: text/html\n\n"; while (($key, $val) = each %ENV) { print "$key = $val<BR>\n"; }
    Enjoy ;)