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 = Archive::Zip->new("file.zip");
13         $fh  = Archive::Zip::MemberRead->new($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       setLineEnd(expr)
47           Set the line end character to use. This is set to \n by default
48           except on Windows systems where it is set to \r\n. You will only
49           need to set this on systems which are not Windows or Unix based and
50           require a line end different from \n.  This is a class method so
51           call as "Archive::Zip::MemberRead"->"setLineEnd($nl)"
52
53       rewind()
54           Rewinds an "Archive::Zip::MemberRead" so that you can read from it
55           again starting at the beginning.
56
57       input_record_separator(expr)
58           If the argument is given, input_record_separator for this instance
59           is set to it. The current setting (which may be the global $/) is
60           always returned.
61
62       input_line_number()
63           Returns the current line number, but only if you're using
64           "getline()".  Using "read()" will not update the line number.
65
66       close()
67           Closes the given file handle.
68
69       buffer_size([ $size ])
70           Gets or sets the buffer size used for reads.  Default is the chunk
71           size used by Archive::Zip.
72
73       getline()
74           Returns the next line from the currently open member.  Makes sense
75           only for text files.  A read error is considered fatal enough to
76           die.  Returns undef on eof. All subsequent calls would return
77           undef, unless a rewind() is called.  Note: The line returned has
78           the input_record_separator (default: newline) removed.
79
80       getline( { preserve_line_ending => 1 } )
81           Returns the next line including the line ending.
82
83       read($buffer, $num_bytes_to_read)
84           Simulates a normal "read()" system call.  Returns the no. of bytes
85           read. "undef" on error, 0 on eof, e.g.:
86
87             $fh = Archive::Zip::MemberRead->new($zip, "sreeji/secrets.bin");
88             while (1)
89             {
90               $read = $fh->read($buffer, 1024);
91               die "FATAL ERROR reading my secrets !\n" if (!defined($read));
92               last if (!$read);
93               # Do processing.
94               ....
95              }
96

AUTHOR

98       Sreeji K. Das <sreeji_k@yahoo.com>
99
100       See Archive::Zip by Ned Konz without which this module does not make
101       any sense!
102
103       Minor mods by Ned Konz.
104
106       Copyright 2002 Sreeji K. Das.
107
108       This program is free software; you can redistribute it and/or modify it
109       under the same terms as Perl itself.
110
111
112
113perl v5.28.0                      2018-09-12       Archive::Zip::MemberRead(3)
Impressum