in reply to backtick in perl 5.8 cgi under iis 6
Maybe your Perl can't locate your shell (cmd.exe), which is needed in order to run dir. I get the exact behaviour you descibe when I unset my PATH.
For example,
#! c:\perl\bin\perl.exe use CGI qw(:standard :html3); use CGI::Carp qw(fatalsToBrowser); print header(); print '<html><body>'; $tmp = `dir`; if (defined($tmp)) { print "Dir: $tmp"; } else { print "Error: $!"; } print '</body></html>';
outputs
Error: Bad file descriptor
when my PATH is unset.
If you're really trying to get a dir listing, it would be much more efficent to use glob or readdir (like neilwatson suggested).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: backtick in perl 5.8 cgi under iis 6
by cseelig (Initiate) on Feb 16, 2006 at 22:05 UTC |