in reply to qx to call command doesn't work via CGI

qx should return undef on error, not an empty string. Check whether the variable is defined. I guess it might be a problem with permissions: note that the CGI script is probably run as a different user than the one who runs it from the prompt.

Replies are listed 'Best First'.
Re^2: qx to call command doesn't work via CGI
by Anonymous Monk on Dec 14, 2011 at 16:36 UTC
    I have
    my $command = '/usr/sfw/bin/smbclient -L rest of command goes here +'; my $output = qx{$command}; if (defined $output){ warn "$output defined"; }else{ warn "$output undefined"; } warn Dumper $output;
    Apage error_log shows " defined at samba.pl line...". Apache runs as the same users I'm running the command line example as. I checked this in the httpd.conf and with the whoami command.