in reply to Re: Porting Code from windows to *nix help
in thread Porting Code from windows to *nix help

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

Replies are listed 'Best First'.
Re^3: Porting Code from windows to *nix help
by Corion (Patriarch) on Jun 29, 2011 at 21:09 UTC

    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.

Re^3: Porting Code from windows to *nix help
by ikegami (Patriarch) on Jun 29, 2011 at 21:09 UTC

    $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

        Notice there's nothing before the ":"? Are you saying the next didn't help? Try printing

        { use Data::Dumper qw( ); local $Data::Dumper::Useqq = 1; local $Data::Dumper::Terse = 1; local $Data::Dumper::Indent = 0; print(Data::Dumper::Dumper($line), "\n"); }

        (And use code tags around output, please)