First I'd like to slap you with a customary RTFM, since the first page of the IO::InnerFile documentation states: "Note that FILEHANDLE must be able to seek() and tell(), in addition to whatever other methods you may desire for reading it." ;)

broquaint offered a solution that manipulated IO::Handle's @ISA. Whilst this works I wouldn't recommend it. Making IO::Handle provide IO::Seekable's methods would perhaps break another class that inherits IO::Handle and uses AUTOLOAD. Or maybe a class inherits something more than IO::Handle, and that other class implements IO::Seekable's methods.

I suggest making an own class that inherits both IO::Handle and IO::Seekable,

{ package MyHandle; use base qw/ IO::Handle IO::Seekable /; }
and then bless the filehandle into that, before passing it to &IO::Innerfile::new:   bless $fh => MyHandle::; Now $fh implements what's needed to make IO::InnerFile function.

Hope I've helped,
ihb

In reply to Re: IO::InnerFile inheriting from IO::Handle? by ihb
in thread IO::InnerFile inheriting from IO::Handle? by BazB

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.