|Perl: the Markov chain saw|
$io->can('seek') == true, but $io->seek(pos, whence) == 'Illegal seek' - bug ?by leriksen (Curate)
|on Nov 15, 2004 at 03:42 UTC||Need Help??|
leriksen has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to test a file handle that may be created from a file or from a 'piped open'. Now you cant seek on a file handle from piped open - its a stream, you get characters from the pipe, you cant jump 'backwards' or 'forwards'.
I thought I could test what kind of hadle I had by checking inheritance from IO::Seekable, or if the handle supported the 'seek' method - a file should, but a stream shouldn't.
But that doesn't seem to be the case - handles from 'piped open' say they inherit from IO::Seekable, and that they can('seek'), but if you do seek(), they fail.
Is that a bug ? Code and output follows