in reply to Re^2: File::stats issue
in thread File::stats issue

For starters, you're using $_ rather than $srcfile in your stat call. That call likely fails.

Secondly, when you use File::stat, you are no longer using a stat or lstat that you see in perlfunc. You're using the ones found in File::stat. These return objects, not an array of items. So you'd get something like:

my $src_stat = stat($srcname); my $dst_stat = lstat($dstfile); my $planesH_stat = stat('/trib/oper/scripts/planesH.s.P370'); printf "%s: %s %d\n", $srcfile, $src_stat->mtime(), $src_stat->size(); printf "%s: %s %d\n", $dstfile, $dst_stat->mtime(), $dst_stat->size();

Replies are listed 'Best First'.
Re^4: File::stats issue
by basarix (Initiate) on Mar 14, 2005 at 20:44 UTC
    Tanktalus.... i've already tried to do something like that, but it gave me an error, complaining that the method couldn't be called on an undefined value....

      In this case, it's because the stat or lstat call failed. Check the return value:

      my $src_stat = stat($srcname) or die "Can't stat $srcname: $!"; my $dst_stat = lstat($dstfile) or die "Can't lstat $dstfile: $!"; my $planesH_stat = stat('/trib/oper/scripts/planesH.s.P370') or die "C +an't stat /trib/oper/scripts/planesH.s.P370: $!";
      Then re-run, and see what it dies of. Hopefully $! gives you enough info to keep going from here.

        Thanx.... i will try to go from there, if not, i will work something from what i can gather from the File::stat info I have finally solved my problem.... funny thing is that it was actually not that hard, once i started thinking about what i was doing...