in reply to 5.8.8 stat and file test fails

Where does it say it doesn't exist? Is the -e test telling you that, or is your system call to unzip telling you that?

If it's unzip telling you the file doesn't exist, I'd guess that the filename has spaces in it or some other character the shell considers significant. Either do some shell escaping, or pass a list to system instead of a string.

If it's -e saying it doesn't exist, then I'm guessing that $new_file maybe doesn't contain what you think it does. You have a pretty good error message to tell you this. Maybe $ccp_home is a relative path, and your current directory isn't what you think it is?

As an aside, I think you may be using chomp a little more than you need to.

Replies are listed 'Best First'.
Re^2: 5.8.8 stat and file test fails
by emwdrich (Initiate) on Aug 18, 2008 at 21:14 UTC
    $ccp_home is an absolute path and the debug line before the if -e statement does return the correct filename and path. If is use stat for $ccp_home/$new_file it says no such file or directory. If I hard code what the file name is it works fine.

    I added the chomp because I was concerned the array was getting newline characters. I never get to unzipping the file.

    This was working prior when I was using Net::FTP. I had to install perl 5.8.8 instead of using 5.005_03 that was already on the system. I installed 5.8.8 so I could get Net::FTPSSL installed.

      Must be a Werewolf :) Try this
      $DEBUG = 1; # if its 0, or undef, no printing printf "zip_file hex [%s]\n", unpack 'H*', "$ccp_home/$new_file" if $D +EBUG; warn "WARNING zip_file has unprintable characters\n" if "$ccp_home/$new_file" =~ /[:^print:]/; printf "zip_file [%s]\n", "$ccp_home/$new_file" if $DEBUG;
      the hex version because there might be non-printable characters in filename.