P
Peter Juuls
In my script I fetch the filesize with stat($_)->size from File::stat.
Occasionally it fails although the file exists, and perl exits with this
error on STDERR: Can't call method "size" on an undefined value at
myscript.pl line 7.
I don't want the script to exit, instead I want to ignore the "bad" file and
continue with the next file. I have tried to do tests on file-existence
BEFORE the stat->size is executed, to prevent perl from exiting, but nothing
seems to work.
use File::stat
......
if ((-e $_) && (-r $_) && ($st = stat($_)) {
$bytes = stat($_)->size ;
}
How can I prevent the script from exiting? (ActiveStatePerl587 on
Windows2000)
Thanks
Best regards
Peter Juuls
Occasionally it fails although the file exists, and perl exits with this
error on STDERR: Can't call method "size" on an undefined value at
myscript.pl line 7.
I don't want the script to exit, instead I want to ignore the "bad" file and
continue with the next file. I have tried to do tests on file-existence
BEFORE the stat->size is executed, to prevent perl from exiting, but nothing
seems to work.
use File::stat
......
if ((-e $_) && (-r $_) && ($st = stat($_)) {
$bytes = stat($_)->size ;
}
How can I prevent the script from exiting? (ActiveStatePerl587 on
Windows2000)
Thanks
Best regards
Peter Juuls