in reply to Can't Get Command Line Unzipper to Execute in CGI/Perl Script

You said:

I'm trying to execute the unzipper from a command in a popular upload script.

And for some reason, that "unzipper" is named "no-frills.exe". Okay, fine. When I searched your code for "no-frills", I found this line (not quite half-way down, at line #464):

open my $wfh, "| no-frills.exe $uploadedfile";
Then I searched for "$wfh". Wouldn't you know... that variable name occurs only once in your 1K lines of code, at that very line #464. So, you open a pipeline file handle to write to this "unzipper" program, but you never write anything to the file handle -- at least, that's how it is in the posted code.

What would you expect to happen, given that the pipeline file handle receives no input?

BTW, while you're fixing that, you might also want to give the full path name to the program when opening the pipe -- there's no guarantee that the web server process knows where it is (has this program in its execution PATH).

Replies are listed 'Best First'.
Re^2: Can't Get Command Line Unzipper to Execute in CGI/Perl Script
by socrtwo (Sexton) on Jun 25, 2009 at 01:53 UTC
    I tried to execute the unzipper with back ticks/quotes too and it didn't work.
    `no-frills.exe $uploadedfile`;
    I just want to unzip a file first. I have a lot more additional (also sloppy but it works) code to add but I can't proceed if I can't get the script to execute an unzip...

    Thanks very much for the valuable suggestion to try the full path. We'll see if that helps.

      system('no-frills.exe', $uploadedfile) or die("no-frills: $?/$!\n");

      Using the multi-argument form of system will help handle non-trivial file names.

      Make sure the current work directory is what you expect it to be.