You can get to the content by using the ->fh method of the entry:

sub _open_sxc_fh($self, $fh, $member, %options) { my $zip = Archive::Zip->new(); my $status = $zip->readFromFileHandle($fh); $status == AZ_OK or croak "Read error from zip"; my $content = $zip->memberNamed($member); if( ! defined $content ) { if( $options{ optional }) { return; } else { croak "Want to read $member' but it doesn't exist!"; } } $content->rewindData(); my $stream = $content->fh; 1 if eof($stream); # reset eof state of $stream?! Is that a bug? W +here? binmode $stream => ':gzip(none)'; return $stream }

The above subroutine gives you a filehandle from which you can read the information. If you want the data directly instead of a filehandle, use the following:

my $mem; my $fh = _open_sxc_fh($self, $zipfh, 'readme.txt'); local $/; my $content = <$fh>; # sluuurp

In reply to Re: Archive::Zip into memory by Corion
in thread Archive::Zip into memory by Takamoto

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.