in reply to FileCache Usage

Most likely because cacheout, whatever that is, returns undef instead an opened filehandle. Check that:

die "Didn't get a sensible result from cacheout() for '$file'. Maybe t +his helps: $!" unless $fh;

Looking closer at your error message and the increasing number of filehandles, it seems that cacheout() returns a fileno and not something that Perl considers a valid, open filehandle. The error is likely in cacheout().

Looking closer at your topic I now realize you're talking about FileCache, stupid me.

Looking even closer, I can't replicate your problem:

Q:\>type test.txt 1 2 3 Q:\>perl -MFileCache -le "my $fh = cacheout('<','test.txt'); print for + <$fh>" 1 2 3 Q:\>perl -MFileCache -le "my $fh = cacheout('<','does-not-exist.txt'); + print for <$fh>" Can't create does-not-exist.txt: No such file or directory at -e line +1

So maybe the file exists but you don't have read permissions? This is on Win32, Perl 5.8.2, stock FileCache

Replies are listed 'Best First'.
Re^2: FileCache Usage
by loris (Hermit) on Feb 09, 2007 at 10:05 UTC

    The file does exist and is readable. Otherwise the open version wouldn't work either, would it?

    Thanks,

    loris


    "It took Loris ten minutes to eat a satsuma . . . twenty minutes to get from one end of his branch to the other . . . and an hour to scratch his bottom. But Slow Loris didn't care. He had a secret . . ." (from "Slow Loris" by Alexis Deacon)