If you look at the code for IO::File, you see this line:

@ISA = qw(IO::Handle IO::Seekable Exporter);

And in IO::FILE's document, it is also stated that: "IO::File inherits from IO::Handle and IO::Seekable. It extends these classes with methods that are specific to file handles.", so it is not a surprise that it inherits seek().

We are looking at two totally different aspects here:

  1. Whether the object knows seek(). For sure it knows, if it is an IO::File;
  2. Whether it actually can successfully seek. Well, depends on, but it shall return the proper return code to indicate success or failure, which it did.

I don't classify this as a bug, although a different person might design the class inheritance structure differently, so this could be handled in a more sophisticated and delicate way.


In reply to Re: $io->can('seek') == true, but $io->seek(pos, whence) == 'Illegal seek' - bug ? by pg
in thread $io->can('seek') == true, but $io->seek(pos, whence) == 'Illegal seek' - bug ? by leriksen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.