in reply to Porting Code from windows to *nix help

Could you isolate the part that's not working, please?
  • Comment on Re: Porting Code from windows to *nix help

Replies are listed 'Best First'.
Re^2: Porting Code from windows to *nix help
by mrbbq (Sexton) on Jun 29, 2011 at 20:59 UTC

    Hi sorry for TMI, below is the part that is not working, in that it doesnt seem to get the correct information from the dir and returns : PlayBuild_XMAC.AHV does not exist

    Seems to fail in here

    open NEWPLAYBUILDFILE, ">", "$c_streamingPlayBuildData/PlayBuild.t +xt.good"; open PLAYBUILDLOGFILE, ">", "$c_streamingPlayBuildData/PlayBuild.t +xt.check"; open FILE, "<", "$c_streamingPlayBuildData/PlayBuild.txt" or die " +Failed to open PlayBuild.txt"; my %buildhash; while (my $line = <FILE>) { my $success = 0; my ($build) = $line =~ s/\n//; #if (!-f "$c_streamingBuildData\\${line}\\PlayBuild_IX86.AHV") if (!-f "$c_streamingBuildData/${line}/PlayBuild_IX86.AHV") { print ("${line}: PlayBuild_IX86.AHV does not exist\n"); print PLAYBUILDLOGFILE ("${line}: PlayBuild_IX86.AHV

      Maybe there is trailing whitespace at the end of $line (and then in $build)?

      You should output the full name of the file you are checking.

      $line surely contains at least a newline to be removed with chomp. (Upd: I didn't notice that you do remove the newline. Sorry. Note that $build contains junk. )

      Furthermore, unless you gave me only half the error message, $line appears to contain nothing other then the newline. Maybe you need something like

      while (my $line = <FILE>) { chomp; # Or more thorough: $line =~ s/\s+\z//; next if !length($line);

        Thanks for the reply, it works fine when the windows version runs and it is hitting the same files. Would the script vary that much from one platform to the next?

        Here is the the actual error: root@irvws054 PlayBuildData# ./CheckD3PlayBuildTxtLocal.pl : PlayBuild_IX86.AHV does not exist : PlayBuild_IX86.AHV does not exist : PlayBuild_IX86.AHV does not exist : PlayBuild_IX86.AHV does not exist : PlayBuild_IX86.AHV does not exist : PlayBuild_IX86.AHV does not exist