in reply to Re: Differences between CGI and command-line versions of scripts?!?
in thread Differences between CGI and command-line versions of scripts?!?

(in CGI the PATH is probably not the same)

Exactly. Unless "." is in $ENV{PATH}, (which is probably won't be when the CGI is invoked), your open() will fail. Replace   open(PS, "ejbreg.pl |") || die "Can't open script"; with   open(PS, "./ejbreg.pl |" ) or die "Can't open script: $!"; And depending on the webserver, you may need to chdir() to get where you need to be.

Replies are listed 'Best First'.
Re: Re: Re: Differences between CGI and command-line versions of scripts?!?
by jbwiv (Acolyte) on Apr 04, 2001 at 19:23 UTC

    Sorry, this seems to have caused some confusion. My actual script looks like:

    my $process='perl c:\winnt\profiles\jbw\builder\' . "guibuilder.pm $NAME $PASS $BOPT $IWEB $INAS $IAPP " . "$IHLP $VERB |"; open(PH, "$process") || die "Can't open process: $process -- $! ";

    Again, the script runs fine from both command line and cgi. It just can't seem to access the LDAP server from cgi...and I can't seem to figure out why.

    Thanks for the tip anyway!