[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] exists $ENV{...} not working?



Consider:

#!/usr/bin/perl --
eval 'exec perl -S $0 ${1+"$@"}'
    if 0;

print "Content-type: text/html\x0d\x0a\x0d\x0a";

print "Version: $]\n";
print "<br>\n";
print "exists \$ENV{'REQUEST_METHOD'} = '", exists $ENV{'REQUEST_METHOD'},
	"'\n";
print "<br>\n";
print "exists \$ENV{'TMPDIR'} = '", exists $ENV{'TMPDIR'}, "'\n";
print "<br>\n";
print "\$ENV{'REQUEST_METHOD'} = '", $ENV{'REQUEST_METHOD'}, "'\n";
print "<br>\n";
print "\$ENV{'TMPDIR'} = '", $ENV{'TMPDIR'}, "'\n";
print "<br>\n";
print "exists \$ENV{'REQUEST_METHOD'} = '", exists $ENV{'REQUEST_METHOD'},
	"'\n";
print "<br>\n";
print "exists \$ENV{'TMPDIR'} = '", exists $ENV{'TMPDIR'}, "'\n";

If I run this on a Unix server, I get the expected:

Version: 5.00404
exists $ENV{'REQUEST_METHOD'} = '1'
exists $ENV{'TMPDIR'} = ''
$ENV{'REQUEST_METHOD'} = 'GET'
$ENV{'TMPDIR'} = ''
exists $ENV{'REQUEST_METHOD'} = '1'
exists $ENV{'TMPDIR'} = ''

(copied from my browser's window, which is why the <br>s went away.)

However, if I run it on a Mac server, I get:

Version: 5.004
exists $ENV{'REQUEST_METHOD'} = ''
exists $ENV{'TMPDIR'} = ''
$ENV{'REQUEST_METHOD'} = 'GET'
$ENV{'TMPDIR'} = 'Macintosh HD:Temporary Items:'
exists $ENV{'REQUEST_METHOD'} = '1'
exists $ENV{'TMPDIR'} = '1'

Interesting how hash elements that don't exist can still have values. :-)

This is on an 840AV running the normal 68k app version of 5.1.5r4, and
MacHTTP 2.2.2 (it does the same thing under WebSTAR 2.1). I saved the
script as a CGI.

I'd appreciate it if someone else could try the above script to verify I
didn't do something stupid. :-)

Brian



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch