Oct 21, 2001, 2:25 PM
Post #3 of 13
I looked over the debugging section in the manpage but @ARGVs are not working. The CGI mod is working beautifully for "URL query strings"; meaning, things that are passed with the URL.
Re: "use CGI" and @ARGV; how to pass...
[In reply to]
The problem, more definitively, is that I am attempting to call the script via a SSI (in which case the URL query string in blank). As a result the $query object has no keys when you attempt to print them in a foreach loop.
I read the section about passing a file that contained params to the $query (http://www.perldoc.com/perl5.6.1/lib/CGI.html#CREATING-A-NEW-QUERY-OBJECT-FROM-AN-INPUT-FILE) and thought "What the heck, let's try that.", so I attempted to pass the ARGV array. This seemed to sort of work. When I did this, I got only the first value of the @ARGV but no more (which I sort of expected to happen). CGI, when evoked in this method, looks for newline to seperate each pair. I was thinking of just constructing a string of the ARGVs like:
manually adding in the newline, but thought that I was dwelling too much into the issue and that CGI should handle this without me having to hack it to work. Unfortunately, this is not what I am seeing.
The EXEC CMD in the SHTML doc looks like this (each pair seperated with a <SPACE> and each key/value seperated with a "="):
<!--#exec cmd="/a/home/shrum/cgi-bin/cgi_test.pl sort=Date max=10 slice=1"-->
and calling the script from within a SSI page, the $query is blank.
(One note of interest: If I call the SSI page and supply a URL query string with it like: http://someserver/cgi_test.shtml?test=1, the $query will then list those URL query string parameters: TEST -> 1.)
and calling the script from within a SSI page, the $query returned:
so you can see where I was going with this.
The script can be viewed here: http://www.shrum.net/cgi_test.pl.txt
Am I using/calling the CGI correctly or is this something that CGI doesn't deal with directly (but should)?