in reply to Invalid File Handle???

You should check if the file system supports atime at all before trying to use it. My guess is that on your system, $sb->atime did not return something usable that localtime could use. In fact, I'm wondering a bit that your localtime seems to return objects, but that may or may not be.

In the end, maybe some code $at ||= localtime or some other sensible default for $at should make your script work in the cases where atime does not return a sensible value.

Replies are listed 'Best First'.
Re^2: Invalid File Handle???
by blackadder (Hermit) on Jul 13, 2005 at 11:36 UTC
    Thanks,...How can I check my windows 2000 desktop to see if it can support atime?

    Also, Not sure on how to use this notation $at ||=localtime! can I just use it in my code as
    my $at ||= localtime $sb->atime;
    Is the above correct?

    or this is correct?
    my $at = localtime $sb->atime || 'UNKNOWN';
    Thanks for the enlightenment.
    Blackadder

      The problem originates from the fact that seemingly, the following code does not return an object:

      my $at = localtime $sb->atime;

      You could print out the result of $sb->atime, or look into the documentation of the module to find out how it behaves on your Windows 2000 desktop.

      As you are using $at as an object later on, you want to synthetize an object for the "unknown" value as well. As I don't know what kind of module you are using that overrides localtime, I can't offer much more help here.

        *cough*

        use Time::localtime;

        --
        We're looking for people in ATL

      Probably not much help, but a confirmation, this script seems to work fine on my Win2K machine. No errors, reasonable results... Tested on Win2K, NTFS and Fat32 file systems, ActivePerl 5.8.6 build 811.