1Archive::Zip::MemberReaUds(e3r)Contributed Perl DocumentAartcihoinve::Zip::MemberRead(3)
2
3
4

NAME

6       Archive::Zip::MemberRead - A wrapper that lets you read Zip archive
7       members as if they were files.
8

SYNOPSIS

10         use Archive::Zip;
11         use Archive::Zip::MemberRead;
12         $zip = new Archive::Zip("file.zip");
13         $fh  = new Archive::Zip::MemberRead($zip, "subdir/abc.txt");
14         while (defined($line = $fh->getline()))
15         {
16             print $fh->input_line_number . "#: $line\n";
17         }
18
19         $read = $fh->read($buffer, 32*1024);
20         print "Read $read bytes as :$buffer:\n";
21

DESCRIPTION

23       The Archive::Zip::MemberRead module lets you read Zip archive member
24       data just like you read data from files.
25

METHODS

27       Archive::Zip::Member::readFileHandle()
28           You can get a "Archive::Zip::MemberRead" from an archive member by
29           calling "readFileHandle()":
30
31             my $member = $zip->memberNamed('abc/def.c');
32             my $fh = $member->readFileHandle();
33             while (defined($line = $fh->getline()))
34             {
35                     # ...
36             }
37             $fh->close();
38
39       Archive::Zip::MemberRead->new($zip, $fileName)
40       Archive::Zip::MemberRead->new($zip, $member)
41       Archive::Zip::MemberRead->new($member)
42           Construct a new Archive::Zip::MemberRead on the specified member.
43
44             my $fh = Archive::Zip::MemberRead->new($zip, 'fred.c')
45
46       rewind()
47           Rewinds an "Archive::Zip::MemberRead" so that you can read from it
48           again starting at the beginning.
49
50       input_line_number()
51           Returns the current line number, but only if you're using "get‐
52           line()".  Using "read()" will not update the line number.
53
54       close()
55           Closes the given file handle.
56
57       buffer_size([ $size ])
58           Gets or sets the buffer size used for reads.  Default is the chunk
59           size used by Archive::Zip.
60
61       getline()
62           Returns the next line from the currently open member.  Makes sense
63           only for text files.  A read error is considered fatal enough to
64           die.  Returns undef on eof. All subsequent calls would return
65           undef, unless a rewind() is called.  Note: The line returned has
66           the newline removed.
67
68       read($buffer, $num_bytes_to_read)
69           Simulates a normal "read()" system call.  Returns the no. of bytes
70           read. "undef" on error, 0 on eof, e.g.:
71
72             $fh = new Archive::Zip::MemberRead($zip, "sreeji/secrets.bin");
73             while (1)
74             {
75               $read = $fh->read($buffer, 1024);
76               die "FATAL ERROR reading my secrets !\n" if (!defined($read));
77               last if (!$read);
78               # Do processing.
79               ....
80              }
81

AUTHOR

83       Sreeji K. Das, <sreeji_k@yahoo.com> See Archive::Zip by Ned Konz with‐
84       out which this module does not make any sense!
85
86       Minor mods by Ned Konz.
87
89       Copyright (c) 2002 Sreeji K. Das. All rights reserved.  This program is
90       free software; you can redistribute it and/or modify it under the same
91       terms as Perl itself.
92
93
94
95perl v5.8.8                       2005-06-20       Archive::Zip::MemberRead(3)
Impressum