View Single Post

  #4 (permalink)  
Old 06-26-2003
David Efflandt
 
Posts: n/a
Default Re: apache2 CGI Perl config problems?

On Wed, 25 Jun 2003 15:33:13 GMT, Mitchua <mitchua@yahoo.com> wrote:
> "David Efflandt" <efflandt@xnet.com> wrote in message <SNIP
>> Try printing out $ARGV[0] once and see what it contains (might not be what
>> you think it is). If you want to use the query string for something, you
>> generally need to parse (and convert any special characters) from
>> $ENV{QUERY_STRING} (or set a variable name in query string and use CGI
>> module).

>
> I had noticed that when I enter addresses with ~'s in them, a \ is placed
> before it. However, in the URL I ran that test with
> (http://www.netkee.com), I just tried outputting ARGV[0] and it looked
> exactly like I entered it.


Try following instead which will fix that and add tags for each variable.
The "bad interpretter" thing sounds like the script may have been
corrupted by touching Windows (wrong line endings, so shell could not
find "perl^M"). Note that my apache does not seem to return anything for
size and modified (or expire, since that does not apply to normal
resources):

#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple
print "Content-type: text/plain\n\n";
$ARGV[0] =~ s/\\//g;
print "$ARGV[0]\n\n";
my @headinfo = head($ARGV[0]);
print scalar(@headinfo) . " items in header\n";
my @label = qw/Type Length Modified Expires Server/;
my $i;
for ($i=0;$i<5;$i++) {
print "$label[$i]: ";
print $headinfo[$i] if $headinfo[$i];
print "\n";
}

--
David Efflandt - All spam ignored http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/