line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Archive::Zip::SimpleZip; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
609438
|
use strict; |
|
5
|
|
|
|
|
47
|
|
|
5
|
|
|
|
|
155
|
|
4
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
207
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require 5.006; |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
2198
|
use IO::Compress::Zip 2.096 qw(:all); |
|
5
|
|
|
|
|
124671
|
|
|
5
|
|
|
|
|
1269
|
|
9
|
5
|
|
|
5
|
|
45
|
use IO::Compress::Base::Common 2.096 (); |
|
5
|
|
|
|
|
76
|
|
|
5
|
|
|
|
|
136
|
|
10
|
5
|
|
|
5
|
|
30
|
use IO::Compress::Adapter::Deflate 2.096 ; |
|
5
|
|
|
|
|
69
|
|
|
5
|
|
|
|
|
713
|
|
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
45
|
use Fcntl (); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
108
|
|
13
|
5
|
|
|
5
|
|
24
|
use File::Spec (); |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
96
|
|
14
|
5
|
|
|
5
|
|
25
|
use IO::File (); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
105
|
|
15
|
5
|
|
|
5
|
|
26
|
use Scalar::Util (); |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
106
|
|
16
|
5
|
|
|
5
|
|
47
|
use Carp; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
8665
|
|
17
|
|
|
|
|
|
|
require Exporter ; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $SimpleZipError); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$SimpleZipError= ''; |
22
|
|
|
|
|
|
|
$VERSION = "0.040"; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
25
|
|
|
|
|
|
|
@EXPORT_OK = qw( $SimpleZipError ) ; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
%EXPORT_TAGS = %IO::Compress::Zip::EXPORT_TAGS ; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Exporter::export_ok_tags('all'); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our %PARAMS = ( |
32
|
|
|
|
|
|
|
'name' => [IO::Compress::Base::Common::Parse_any, ''], |
33
|
|
|
|
|
|
|
'comment' => [IO::Compress::Base::Common::Parse_any, ''], |
34
|
|
|
|
|
|
|
'zipcomment' => [IO::Compress::Base::Common::Parse_any, ''], |
35
|
|
|
|
|
|
|
'stream' => [IO::Compress::Base::Common::Parse_boolean, 0], |
36
|
|
|
|
|
|
|
'method' => [IO::Compress::Base::Common::Parse_unsigned, ZIP_CM_DEFLATE], |
37
|
|
|
|
|
|
|
'minimal' => [IO::Compress::Base::Common::Parse_boolean, 0], |
38
|
|
|
|
|
|
|
'zip64' => [IO::Compress::Base::Common::Parse_boolean, 0], |
39
|
|
|
|
|
|
|
'filtername' => [IO::Compress::Base::Common::Parse_code, undef], |
40
|
|
|
|
|
|
|
'canonicalname' => [IO::Compress::Base::Common::Parse_boolean, 1], |
41
|
|
|
|
|
|
|
'textflag' => [IO::Compress::Base::Common::Parse_boolean, 0], |
42
|
|
|
|
|
|
|
'storelinks' => [IO::Compress::Base::Common::Parse_boolean, 0], |
43
|
|
|
|
|
|
|
'autoflush' => [IO::Compress::Base::Common::Parse_boolean, 0], |
44
|
|
|
|
|
|
|
#'storedirs' => [IO::Compress::Base::Common::Parse_boolean, 0], |
45
|
|
|
|
|
|
|
'encode' => [IO::Compress::Base::Common::Parse_any, undef], |
46
|
|
|
|
|
|
|
#'extrafieldlocal' => [IO::Compress::Base::Common::Parse_any, undef], |
47
|
|
|
|
|
|
|
#'extrafieldcentral'=> [IO::Compress::Base::Common::Parse_any, undef], |
48
|
|
|
|
|
|
|
'filtercontainer' => [IO::Compress::Base::Common::Parse_code, undef], |
49
|
|
|
|
|
|
|
# 'time' => [IO::Compress::Base::Common::Parse_any, undef], |
50
|
|
|
|
|
|
|
# 'extime' => [IO::Compress::Base::Common::Parse_any, undef], |
51
|
|
|
|
|
|
|
# 'efs' => [IO::Compress::Base::Common::Parse_boolean, 0], |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Zlib |
54
|
|
|
|
|
|
|
'level' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_COMPRESSION], |
55
|
|
|
|
|
|
|
'strategy' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_STRATEGY], |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Lzma |
58
|
|
|
|
|
|
|
'preset' => [IO::Compress::Base::Common::Parse_unsigned, 6], |
59
|
|
|
|
|
|
|
'extreme' => [IO::Compress::Base::Common::Parse_boolean, 0], |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Bzip2 |
62
|
|
|
|
|
|
|
'blocksize100k' => [IO::Compress::Base::Common::Parse_unsigned, 1], |
63
|
|
|
|
|
|
|
'workfactor' => [IO::Compress::Base::Common::Parse_unsigned, 0], |
64
|
|
|
|
|
|
|
'verbosity' => [IO::Compress::Base::Common::Parse_boolean, 0], |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _ckParams |
69
|
|
|
|
|
|
|
{ |
70
|
1199
|
|
66
|
1199
|
|
3709
|
my $got = shift || IO::Compress::Base::Parameters::new(); |
71
|
1199
|
|
|
|
|
4773
|
my $top = shift; |
72
|
|
|
|
|
|
|
|
73
|
1199
|
100
|
|
|
|
3783
|
$got->parse(\%PARAMS, @_) |
74
|
|
|
|
|
|
|
or _myDie("Parameter Error: " . $got->getError()) ; |
75
|
|
|
|
|
|
|
|
76
|
1197
|
100
|
|
|
|
255747
|
if ($top) |
77
|
|
|
|
|
|
|
{ |
78
|
233
|
|
|
|
|
671
|
for my $opt ( qw(name comment) ) |
79
|
|
|
|
|
|
|
{ |
80
|
465
|
100
|
|
|
|
2146
|
_myDie("$opt option not valid in constructor") |
81
|
|
|
|
|
|
|
if $got->parsed($opt); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
231
|
|
|
|
|
1453
|
$got->setValue('crc32' => 1); |
85
|
231
|
|
|
|
|
2201
|
$got->setValue('adler32' => 0); |
86
|
231
|
|
|
|
|
1705
|
$got->setValue('os_code' => $Compress::Raw::Zlib::gzip_os_code); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
else |
89
|
|
|
|
|
|
|
{ |
90
|
964
|
|
|
|
|
1811
|
for my $opt ( qw( zipcomment) ) |
91
|
|
|
|
|
|
|
{ |
92
|
964
|
100
|
|
|
|
2279
|
_myDie("$opt option only valid in constructor") |
93
|
|
|
|
|
|
|
if $got->parsed($opt); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
1194
|
|
|
|
|
7036
|
my $e = $got->getValue("encode"); |
98
|
1194
|
100
|
|
|
|
5349
|
if (defined $e) |
99
|
|
|
|
|
|
|
{ |
100
|
13
|
50
|
|
|
|
38
|
_myDie("Encode::find_encoding not found") if ! defined &Encode::find_encoding; |
101
|
13
|
100
|
|
|
|
40
|
_myDie("Unknown Encoding '$e'") if ! defined Encode::find_encoding($e) ; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
1193
|
|
|
|
|
2309
|
return $got; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub _illegalFilename |
108
|
|
|
|
|
|
|
{ |
109
|
3
|
|
|
3
|
|
120
|
return _setError(undef, undef, "Illegal Filename") ; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#sub simplezip |
114
|
|
|
|
|
|
|
#{ |
115
|
|
|
|
|
|
|
# my $from = shift; |
116
|
|
|
|
|
|
|
# my $filename = shift ; |
117
|
|
|
|
|
|
|
# #my %opts |
118
|
|
|
|
|
|
|
# |
119
|
|
|
|
|
|
|
# my $z = new Archive::Zip::SimpleZip $filename, @_; |
120
|
|
|
|
|
|
|
# |
121
|
|
|
|
|
|
|
# if (ref $from eq 'ARRAY') |
122
|
|
|
|
|
|
|
# { |
123
|
|
|
|
|
|
|
# $z->add($_) for @$from; |
124
|
|
|
|
|
|
|
# } |
125
|
|
|
|
|
|
|
# elsif (ref $from) |
126
|
|
|
|
|
|
|
# { |
127
|
|
|
|
|
|
|
# die "bad"; |
128
|
|
|
|
|
|
|
# } |
129
|
|
|
|
|
|
|
# else |
130
|
|
|
|
|
|
|
# { |
131
|
|
|
|
|
|
|
# $z->add($filename); |
132
|
|
|
|
|
|
|
# } |
133
|
|
|
|
|
|
|
# |
134
|
|
|
|
|
|
|
# $z->close(); |
135
|
|
|
|
|
|
|
#} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub new |
139
|
|
|
|
|
|
|
{ |
140
|
238
|
|
|
238
|
0
|
1068857
|
my $class = shift; |
141
|
|
|
|
|
|
|
|
142
|
238
|
|
|
|
|
671
|
$SimpleZipError = ''; |
143
|
|
|
|
|
|
|
|
144
|
238
|
100
|
|
|
|
927
|
return _setError(undef, undef, "Missing Filename") |
145
|
|
|
|
|
|
|
unless @_ ; |
146
|
|
|
|
|
|
|
|
147
|
237
|
|
|
|
|
423
|
my $outValue = shift ; |
148
|
237
|
|
|
|
|
372
|
my $fh; |
149
|
|
|
|
|
|
|
|
150
|
237
|
100
|
|
|
|
716
|
if (!defined $outValue) |
151
|
|
|
|
|
|
|
{ |
152
|
1
|
|
|
|
|
7
|
return _illegalFilename |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
236
|
|
|
|
|
645
|
my $isSTDOUT = ($outValue eq '-') ; |
156
|
236
|
|
|
|
|
1025
|
my $outType = IO::Compress::Base::Common::whatIsOutput($outValue); |
157
|
|
|
|
|
|
|
|
158
|
236
|
100
|
66
|
|
|
9404
|
if ($outType eq 'filename') |
|
|
50
|
|
|
|
|
|
159
|
|
|
|
|
|
|
{ |
160
|
145
|
100
|
66
|
|
|
2944
|
if (-e $outValue && ( ! -f _ || ! -w _)) |
|
|
|
100
|
|
|
|
|
161
|
|
|
|
|
|
|
{ |
162
|
1
|
|
|
|
|
6
|
return _illegalFilename |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
144
|
100
|
|
|
|
1433
|
$fh = new IO::File ">$outValue" |
166
|
|
|
|
|
|
|
or return _illegalFilename; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
elsif( $outType eq 'buffer' || $outType eq 'handle') |
169
|
|
|
|
|
|
|
{ |
170
|
91
|
|
|
|
|
195
|
$fh = $outValue; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
else |
173
|
|
|
|
|
|
|
{ |
174
|
0
|
|
|
|
|
0
|
return _illegalFilename |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
234
|
|
|
|
|
18126
|
my $got = _ckParams(undef, 1, @_); |
178
|
230
|
100
|
|
|
|
932
|
$got->setValue('autoclose' => 1) unless $outType eq 'handle' ; |
179
|
230
|
100
|
|
|
|
1741
|
$got->setValue('stream' => 1) if $isSTDOUT ; |
180
|
|
|
|
|
|
|
|
181
|
230
|
|
|
|
|
1632
|
my $obj = { |
182
|
|
|
|
|
|
|
ZipFile => $outValue, |
183
|
|
|
|
|
|
|
FH => $fh, |
184
|
|
|
|
|
|
|
Open => 1, |
185
|
|
|
|
|
|
|
FilesWritten => 0, |
186
|
|
|
|
|
|
|
Opts => $got, |
187
|
|
|
|
|
|
|
Error => undef, |
188
|
|
|
|
|
|
|
Raw => undef, |
189
|
|
|
|
|
|
|
}; |
190
|
|
|
|
|
|
|
|
191
|
230
|
|
|
|
|
1098
|
bless $obj, $class; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub DESTROY |
195
|
|
|
|
|
|
|
{ |
196
|
230
|
|
|
230
|
|
1957503
|
my $self = shift; |
197
|
230
|
|
|
|
|
834
|
$self->close(); |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub close |
201
|
|
|
|
|
|
|
{ |
202
|
448
|
|
|
448
|
1
|
39956
|
my $self = shift; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
return 0 |
205
|
448
|
100
|
|
|
|
6911
|
if ! $self->{Open} ; |
206
|
|
|
|
|
|
|
|
207
|
230
|
|
|
|
|
425
|
$self->{Open} = 0; |
208
|
230
|
100
|
66
|
|
|
805
|
if ($self->{FilesWritten} || defined $self->{Raw}) |
209
|
|
|
|
|
|
|
{ |
210
|
224
|
50
|
|
|
|
655
|
if(defined $self->{Zip}) |
211
|
|
|
|
|
|
|
{ |
212
|
224
|
100
|
|
|
|
569
|
if (defined $self->{Raw}) |
213
|
|
|
|
|
|
|
{ |
214
|
2
|
|
|
|
|
6
|
$self->{Raw} = undef ; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
224
|
50
|
|
|
|
1041
|
$self->{Zip}->_flushCompressed() || return 0; |
218
|
224
|
50
|
|
|
|
19089
|
$self->{Zip}->close() || return 0; |
219
|
224
|
|
|
|
|
87435
|
delete $self->{Zip} ; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
230
|
|
|
|
|
19045
|
1; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub _newStream |
227
|
|
|
|
|
|
|
{ |
228
|
961
|
|
|
961
|
|
1338
|
my $self = shift; |
229
|
961
|
|
|
|
|
1191
|
my $filename = shift ; |
230
|
961
|
|
|
|
|
1226
|
my $options = shift; |
231
|
|
|
|
|
|
|
|
232
|
961
|
100
|
|
|
|
1734
|
if (defined $filename) |
233
|
|
|
|
|
|
|
{ |
234
|
27
|
|
|
|
|
131
|
IO::Compress::Zip::getFileInfo(undef, $options, $filename) ; |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
# Force STORE for directories, symbolic links & empty files |
237
|
27
|
100
|
66
|
|
|
5254
|
$options->setValue(method => ZIP_CM_STORE) |
|
|
|
100
|
|
|
|
|
238
|
|
|
|
|
|
|
if -d $filename || -z _ || -l $filename ; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
# Archive::Zip::SimpleZip handles canonical |
242
|
961
|
|
|
|
|
2470
|
$options->setValue(canonicalname => 0); |
243
|
|
|
|
|
|
|
|
244
|
961
|
|
|
|
|
6551
|
$! = 0; |
245
|
961
|
100
|
|
|
|
2159
|
if (! defined $self->{Zip}) { |
246
|
224
|
|
|
|
|
843
|
$self->{Zip} = IO::Compress::Base::Common::createSelfTiedObject('IO::Compress::Zip', \$SimpleZipError); |
247
|
|
|
|
|
|
|
$self->{Zip}->_create($options, $self->{FH}) |
248
|
224
|
50
|
|
|
|
12485
|
or die "_create $SimpleZipError"; |
249
|
|
|
|
|
|
|
$self->{Zip}->autoflush() |
250
|
224
|
100
|
|
|
|
237393
|
if $options->getValue('autoflush'); |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
else { |
254
|
737
|
50
|
|
|
|
2884
|
$self->{Zip}->_newStream($options) |
255
|
|
|
|
|
|
|
or die "_newStream - $SimpleZipError"; |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
961
|
|
|
|
|
697623
|
++ $self->{FilesWritten} ; |
259
|
|
|
|
|
|
|
|
260
|
961
|
|
|
|
|
2217
|
return 1; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub _setError |
265
|
|
|
|
|
|
|
{ |
266
|
7
|
|
|
7
|
|
19
|
$SimpleZipError = $_[2] ; |
267
|
7
|
100
|
|
|
|
28
|
$_[0]->{Error} = $_[2] |
268
|
|
|
|
|
|
|
if defined $_[0] ; |
269
|
|
|
|
|
|
|
|
270
|
7
|
|
|
|
|
34
|
return $_[1]; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub error |
275
|
|
|
|
|
|
|
{ |
276
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
277
|
0
|
|
|
|
|
0
|
return $self->{Error}; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
sub _myDie |
281
|
|
|
|
|
|
|
{ |
282
|
8
|
|
|
8
|
|
1272
|
$SimpleZipError = $_[0]; |
283
|
8
|
|
|
|
|
1269
|
Carp::croak $_[0]; |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub _stdPreq |
288
|
|
|
|
|
|
|
{ |
289
|
968
|
|
|
968
|
|
1352
|
my $self = shift; |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
return 0 |
292
|
968
|
50
|
|
|
|
2790
|
if $self->{Error} ; |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
return $self->_setError(0, "Zip file closed") |
295
|
968
|
50
|
|
|
|
2221
|
if ! $self->{Open} ; |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
return $self->_setError(0, "openMember filehandle already open") |
298
|
968
|
100
|
|
|
|
2109
|
if defined $self->{Raw}; |
299
|
|
|
|
|
|
|
|
300
|
966
|
|
|
|
|
2180
|
return 1; |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
sub add |
304
|
|
|
|
|
|
|
{ |
305
|
29
|
|
|
29
|
1
|
6974
|
my $self = shift; |
306
|
29
|
|
|
|
|
78
|
my $filename = shift; |
307
|
|
|
|
|
|
|
|
308
|
29
|
50
|
|
|
|
118
|
$self->_stdPreq or return 0 ; |
309
|
|
|
|
|
|
|
|
310
|
29
|
100
|
|
|
|
657
|
return $self->_setError(0, "File '$filename' does not exist") |
311
|
|
|
|
|
|
|
if ! -e $filename ; |
312
|
|
|
|
|
|
|
|
313
|
28
|
50
|
|
|
|
411
|
return $self->_setError(0, "File '$filename' cannot be read") |
314
|
|
|
|
|
|
|
if ! -r $filename ; |
315
|
|
|
|
|
|
|
|
316
|
28
|
|
|
|
|
213
|
my $options = $self->{Opts}->clone(); |
317
|
|
|
|
|
|
|
|
318
|
28
|
|
|
|
|
3265
|
my $got = _ckParams($options, 0, @_); |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
# Force Encode off. |
321
|
27
|
|
|
|
|
102
|
$got->setValue('encode', undef); |
322
|
|
|
|
|
|
|
|
323
|
27
|
|
100
|
|
|
274
|
my $isLink = $got->getValue('storelinks') && -l $filename ; |
324
|
27
|
|
|
|
|
618
|
my $isDir = -d $filename; |
325
|
|
|
|
|
|
|
|
326
|
27
|
50
|
33
|
|
|
228
|
return 0 |
327
|
|
|
|
|
|
|
if $filename eq '.' || $filename eq '..'; |
328
|
|
|
|
|
|
|
|
329
|
27
|
100
|
|
|
|
111
|
if ($options->getValue("canonicalname")) |
330
|
|
|
|
|
|
|
{ |
331
|
26
|
100
|
|
|
|
184
|
if (! $got->parsed("name")) |
332
|
|
|
|
|
|
|
{ |
333
|
18
|
|
100
|
|
|
213
|
$got->setValue(name => IO::Compress::Zip::canonicalName($filename, $isDir && ! $isLink)); |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
else |
336
|
|
|
|
|
|
|
{ |
337
|
8
|
|
33
|
|
|
45
|
$got->setValue(name => IO::Compress::Zip::canonicalName($got->getValue("name"), $isDir && ! $isLink)); |
338
|
|
|
|
|
|
|
} |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
27
|
|
|
|
|
1657
|
my ($mode, $uid, $gid, $size, $atime, $mtime, $ctime) ; |
342
|
|
|
|
|
|
|
|
343
|
27
|
100
|
|
|
|
75
|
if ( $got->parsed('storelinks') ) |
344
|
|
|
|
|
|
|
{ |
345
|
5
|
|
|
|
|
108
|
($mode, $uid, $gid, $size, $atime, $mtime, $ctime) |
346
|
|
|
|
|
|
|
= (lstat($filename))[2, 4, 5, 7, 8, 9, 10] ; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
else |
349
|
|
|
|
|
|
|
{ |
350
|
22
|
|
|
|
|
449
|
($mode, $uid, $gid, $size, $atime, $mtime, $ctime) |
351
|
|
|
|
|
|
|
= (stat($filename))[2, 4, 5,7, 8, 9, 10] ; |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
27
|
|
|
|
|
156
|
$got->setValue(time => $mtime); |
355
|
|
|
|
|
|
|
|
356
|
27
|
50
|
|
|
|
244
|
if (! $got->getValue('minimal')) { |
357
|
|
|
|
|
|
|
|
358
|
27
|
|
|
|
|
203
|
$got->setValue(extime => [$atime, $mtime, $ctime]) ; |
359
|
|
|
|
|
|
|
|
360
|
5
|
|
|
5
|
|
2938
|
use Perl::OSType; |
|
5
|
|
|
|
|
2335
|
|
|
5
|
|
|
|
|
7483
|
|
361
|
27
|
|
|
|
|
281
|
my $type = Perl::OSType::os_type(); |
362
|
27
|
50
|
|
|
|
346
|
if ( $type eq 'Unix' ) |
363
|
|
|
|
|
|
|
{ |
364
|
27
|
|
|
|
|
108
|
$got->setValue(exunixn => [$uid, $gid]) ; |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
# TODO add Windows |
367
|
|
|
|
|
|
|
} |
368
|
|
|
|
|
|
|
|
369
|
27
|
|
|
|
|
264
|
$self->_newStream($filename, $got); |
370
|
|
|
|
|
|
|
|
371
|
27
|
100
|
|
|
|
723
|
if($isLink) |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
372
|
|
|
|
|
|
|
{ |
373
|
3
|
|
|
|
|
47
|
my $target = readlink($filename); |
374
|
3
|
|
|
|
|
82
|
$self->{Zip}->write($target); |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
elsif (-d $filename) |
377
|
|
|
|
|
|
|
{ |
378
|
|
|
|
|
|
|
# Do nothing, a directory has no payload |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
elsif (-f $filename) |
381
|
|
|
|
|
|
|
{ |
382
|
19
|
50
|
|
|
|
211
|
my $fh = new IO::File "<$filename" |
383
|
|
|
|
|
|
|
or die "Cannot open file $filename: $!"; |
384
|
|
|
|
|
|
|
|
385
|
19
|
|
|
|
|
1879
|
binmode $fh; |
386
|
|
|
|
|
|
|
|
387
|
19
|
|
|
|
|
54
|
my $data; |
388
|
|
|
|
|
|
|
my $last ; |
389
|
19
|
|
|
|
|
115
|
while ($fh->read($data, 1024 * 16)) |
390
|
|
|
|
|
|
|
{ |
391
|
19
|
|
|
|
|
586
|
$self->{Zip}->write($data); |
392
|
|
|
|
|
|
|
} |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
else |
395
|
|
|
|
|
|
|
{ |
396
|
0
|
|
|
|
|
0
|
return 0; |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
|
399
|
27
|
|
|
|
|
3322
|
return 1; |
400
|
|
|
|
|
|
|
} |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
sub addString |
404
|
|
|
|
|
|
|
{ |
405
|
862
|
|
|
862
|
1
|
203437
|
my $self = shift; |
406
|
862
|
|
|
|
|
1510
|
my $string = shift; |
407
|
|
|
|
|
|
|
|
408
|
862
|
100
|
|
|
|
1939
|
$self->_stdPreq or return 0 ; |
409
|
|
|
|
|
|
|
|
410
|
861
|
|
|
|
|
3288
|
my $options = $self->{Opts}->clone(); |
411
|
|
|
|
|
|
|
|
412
|
861
|
|
|
|
|
89877
|
my $got = _ckParams($options, 0, @_); |
413
|
|
|
|
|
|
|
|
414
|
860
|
100
|
|
|
|
1758
|
_myDie("Missing 'Name' parameter in addString") |
415
|
|
|
|
|
|
|
if ! $got->parsed("name"); |
416
|
|
|
|
|
|
|
|
417
|
859
|
100
|
|
|
|
3659
|
$got->setValue(name => IO::Compress::Zip::canonicalName($got->getValue("name"))) |
418
|
|
|
|
|
|
|
if $options->getValue("canonicalname") ; |
419
|
|
|
|
|
|
|
|
420
|
859
|
|
|
|
|
5145
|
$self->_newStream(undef, $got); |
421
|
859
|
|
|
|
|
2849
|
$self->{Zip}->write($string); |
422
|
|
|
|
|
|
|
|
423
|
859
|
|
|
|
|
61040
|
return 1; |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
sub addFileHandle |
427
|
|
|
|
|
|
|
{ |
428
|
2
|
|
|
2
|
1
|
665
|
my $self = shift; |
429
|
2
|
|
|
|
|
5
|
my $fh = shift; |
430
|
|
|
|
|
|
|
|
431
|
2
|
50
|
|
|
|
9
|
$self->_stdPreq or return 0 ; |
432
|
|
|
|
|
|
|
|
433
|
2
|
|
|
|
|
11
|
my $options = $self->{Opts}->clone() ; |
434
|
|
|
|
|
|
|
|
435
|
2
|
|
|
|
|
214
|
my $got = _ckParams($options, 0, @_); |
436
|
|
|
|
|
|
|
|
437
|
2
|
100
|
|
|
|
8
|
_myDie("Missing 'Name' parameter in addFileHandle") |
438
|
|
|
|
|
|
|
if ! $got->parsed("name"); |
439
|
|
|
|
|
|
|
|
440
|
1
|
50
|
|
|
|
8
|
$got->setValue(name => IO::Compress::Zip::canonicalName($got->getValue("name"))) |
441
|
|
|
|
|
|
|
if $options->getValue("canonicalname") ; |
442
|
|
|
|
|
|
|
|
443
|
1
|
|
|
|
|
53
|
$self->_newStream(undef, $got); |
444
|
|
|
|
|
|
|
|
445
|
1
|
|
|
|
|
3
|
my $data; |
446
|
|
|
|
|
|
|
|
447
|
1
|
|
|
|
|
11
|
while ($fh->read($data, 1024 * 16)) |
448
|
|
|
|
|
|
|
{ |
449
|
1
|
|
|
|
|
57
|
$self->{Zip}->write($data); |
450
|
|
|
|
|
|
|
} |
451
|
|
|
|
|
|
|
|
452
|
1
|
|
|
|
|
134
|
return 1; |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
# sub createDirectory |
456
|
|
|
|
|
|
|
# { |
457
|
|
|
|
|
|
|
# my $self = shift ; |
458
|
|
|
|
|
|
|
# my $directory = shift; |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
# # TODO - file attributes |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
# $self->_stdPreq or return 0 ; |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
# my $got = _ckParams($options, 0, @_); |
465
|
|
|
|
|
|
|
# $got->setValue(name => IO::Compress::Zip::canonicalName($filename, 1)); |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
# $self->_newStream(undef, $got); |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
# return 1; |
470
|
|
|
|
|
|
|
# } |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
sub openMember |
473
|
|
|
|
|
|
|
{ |
474
|
75
|
|
|
75
|
1
|
7580
|
my $self = shift; |
475
|
|
|
|
|
|
|
|
476
|
75
|
100
|
|
|
|
187
|
$self->_stdPreq or return undef ; |
477
|
|
|
|
|
|
|
|
478
|
74
|
|
|
|
|
271
|
my $options = $self->{Opts}->clone(); |
479
|
|
|
|
|
|
|
|
480
|
74
|
|
|
|
|
7587
|
my $got = _ckParams($options, 0, @_); |
481
|
|
|
|
|
|
|
|
482
|
74
|
50
|
|
|
|
169
|
_myDie("Missing 'Name' parameter in openMember") |
483
|
|
|
|
|
|
|
if ! $got->parsed("name"); |
484
|
|
|
|
|
|
|
|
485
|
74
|
100
|
|
|
|
328
|
$got->setValue(name => IO::Compress::Zip::canonicalName($got->getValue("name"))) |
486
|
|
|
|
|
|
|
if $options->getValue("canonicalname") ; |
487
|
|
|
|
|
|
|
|
488
|
74
|
|
|
|
|
3397
|
$self->_newStream(undef, $got); |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
# if (1) |
491
|
|
|
|
|
|
|
# { |
492
|
74
|
|
|
|
|
240
|
my $z = IO::Compress::Base::Common::createSelfTiedObject("Archive::Zip::SimpleZip::Handle", \$SimpleZipError) ; |
493
|
|
|
|
|
|
|
|
494
|
74
|
|
|
|
|
877
|
$self->{Raw} = 1; |
495
|
|
|
|
|
|
|
|
496
|
74
|
|
|
|
|
141
|
*$z->{Open} = 1 ; |
497
|
74
|
|
|
|
|
142
|
*$z->{SZ} = $self; |
498
|
74
|
|
|
|
|
278
|
Scalar::Util::weaken *$z->{SZ}; # for 5.8 |
499
|
|
|
|
|
|
|
|
500
|
74
|
|
|
|
|
561
|
return $z; |
501
|
|
|
|
|
|
|
# } |
502
|
|
|
|
|
|
|
# else |
503
|
|
|
|
|
|
|
# { |
504
|
|
|
|
|
|
|
# my $handle = Symbol::gensym(); |
505
|
|
|
|
|
|
|
# tie *$handle, "Archive::Zip::SimpleZip::Handle", $self, $self->{Zip}; |
506
|
|
|
|
|
|
|
# |
507
|
|
|
|
|
|
|
# $self->{Raw} = 1; |
508
|
|
|
|
|
|
|
# |
509
|
|
|
|
|
|
|
# return $handle; |
510
|
|
|
|
|
|
|
# } |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
sub STORABLE_freeze |
514
|
|
|
|
|
|
|
{ |
515
|
0
|
|
|
0
|
0
|
0
|
my $type = ref shift; |
516
|
0
|
|
|
|
|
0
|
croak "Cannot freeze $type object\n"; |
517
|
|
|
|
|
|
|
} |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
sub STORABLE_thaw |
520
|
|
|
|
|
|
|
{ |
521
|
0
|
|
|
0
|
0
|
0
|
my $type = ref shift; |
522
|
0
|
|
|
|
|
0
|
croak "Cannot thaw $type object\n"; |
523
|
|
|
|
|
|
|
} |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
{ |
528
|
|
|
|
|
|
|
package Archive::Zip::SimpleZip::Handle ; |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
sub TIEHANDLE |
531
|
|
|
|
|
|
|
{ |
532
|
74
|
50
|
|
74
|
|
2243
|
return $_[0] if ref($_[0]); |
533
|
0
|
|
|
|
|
0
|
die "OOPS\n" ; |
534
|
|
|
|
|
|
|
} |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
sub UNTIE |
537
|
|
|
|
|
|
|
{ |
538
|
0
|
|
|
0
|
|
0
|
my $self = shift ; |
539
|
|
|
|
|
|
|
} |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
sub DESTROY |
542
|
|
|
|
|
|
|
{ |
543
|
74
|
|
|
74
|
|
116453
|
my $self = shift ; |
544
|
74
|
|
|
|
|
563
|
local ($., $@, $!, $^E, $?); |
545
|
74
|
|
|
|
|
240
|
$self->close() ; |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
# TODO - memory leak with 5.8.0 - this isn't called until |
548
|
|
|
|
|
|
|
# global destruction |
549
|
|
|
|
|
|
|
# |
550
|
74
|
|
|
|
|
132
|
%{ *$self } = () ; |
|
74
|
|
|
|
|
322
|
|
551
|
74
|
|
|
|
|
590
|
undef $self ; |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
sub close |
556
|
|
|
|
|
|
|
{ |
557
|
143
|
|
|
143
|
|
12501
|
my $self = shift ; |
558
|
143
|
100
|
|
|
|
455
|
return 1 if ! *$self->{Open}; |
559
|
|
|
|
|
|
|
|
560
|
74
|
|
|
|
|
137
|
*$self->{Open} = 0 ; |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
# untie *$self |
563
|
|
|
|
|
|
|
# if $] >= 5.008 ; |
564
|
|
|
|
|
|
|
|
565
|
74
|
50
|
|
|
|
176
|
if (defined *$self->{SZ}) |
566
|
|
|
|
|
|
|
{ |
567
|
74
|
|
|
|
|
137
|
*$self->{SZ}{Raw} = undef ; |
568
|
74
|
|
|
|
|
136
|
*$self->{SZ} = undef ; |
569
|
|
|
|
|
|
|
} |
570
|
|
|
|
|
|
|
|
571
|
74
|
|
|
|
|
331
|
1; |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
sub print |
575
|
|
|
|
|
|
|
{ |
576
|
70
|
|
|
70
|
|
12953
|
my $self = shift; |
577
|
70
|
100
|
|
|
|
206
|
$self->_stdPreq() or return 0 ; |
578
|
|
|
|
|
|
|
|
579
|
68
|
|
|
|
|
311
|
*$self->{SZ}{Zip}->print(@_); |
580
|
|
|
|
|
|
|
} |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
sub printf |
583
|
|
|
|
|
|
|
{ |
584
|
6
|
|
|
6
|
|
1135
|
my $self = shift; |
585
|
6
|
50
|
|
|
|
19
|
$self->_stdPreq() or return 0 ; |
586
|
|
|
|
|
|
|
|
587
|
6
|
|
|
|
|
39
|
*$self->{SZ}{Zip}->printf(@_); |
588
|
|
|
|
|
|
|
} |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
sub syswrite |
591
|
|
|
|
|
|
|
{ |
592
|
6
|
|
|
6
|
|
1588
|
my $self = shift; |
593
|
6
|
50
|
|
|
|
19
|
$self->_stdPreq() or return 0 ; |
594
|
|
|
|
|
|
|
|
595
|
6
|
|
|
|
|
25
|
*$self->{SZ}{Zip}->syswrite(@_); |
596
|
|
|
|
|
|
|
} |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
sub tell |
599
|
|
|
|
|
|
|
{ |
600
|
9
|
|
|
9
|
|
1294
|
my $self = shift; |
601
|
9
|
50
|
|
|
|
22
|
$self->_stdPreq() or return 0 ; |
602
|
|
|
|
|
|
|
|
603
|
9
|
|
|
|
|
48
|
*$self->{SZ}{Zip}->tell(@_); |
604
|
|
|
|
|
|
|
} |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
sub eof |
607
|
|
|
|
|
|
|
{ |
608
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
609
|
0
|
0
|
|
|
|
0
|
$self->_stdPreq() or return 0 ; |
610
|
|
|
|
|
|
|
|
611
|
0
|
|
|
|
|
0
|
*$self->{SZ}{Zip}->eof; |
612
|
|
|
|
|
|
|
} |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
sub _stdPreq |
615
|
|
|
|
|
|
|
{ |
616
|
91
|
|
|
91
|
|
140
|
my $self = shift; |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
return _setError("Zip file closed") |
619
|
91
|
100
|
66
|
|
|
504
|
if ! defined defined *$self->{SZ} || ! *$self->{SZ}{Open} ; |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
return _setError("openMember filehandle closed") |
623
|
89
|
50
|
33
|
|
|
377
|
if ! *$self->{Open} || ! defined *$self->{SZ}{Raw}; |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
return 0 |
626
|
89
|
50
|
|
|
|
221
|
if *$self->{SZ}{Error} ; |
627
|
|
|
|
|
|
|
|
628
|
89
|
|
|
|
|
221
|
return 1; |
629
|
|
|
|
|
|
|
} |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
sub _setError |
632
|
|
|
|
|
|
|
{ |
633
|
2
|
|
|
2
|
|
4
|
$Archive::Zip::SimpleZip::SimpleZipError = $_[0] ; |
634
|
2
|
|
|
|
|
13
|
return 0; |
635
|
|
|
|
|
|
|
} |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
sub clearerr |
638
|
|
|
|
|
|
|
{ |
639
|
0
|
|
|
0
|
|
|
my $self = shift; |
640
|
|
|
|
|
|
|
|
641
|
0
|
|
|
|
|
|
return 0; |
642
|
|
|
|
|
|
|
} |
643
|
|
|
|
|
|
|
|
644
|
0
|
|
|
0
|
|
|
sub binmode { 1 } |
645
|
|
|
|
|
|
|
# sub clearerr { $Archive::Zip::SimpleZip::SimpleZipError = '' } |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
*FILENO = \&fileno; |
648
|
|
|
|
|
|
|
*PRINT = \&print; |
649
|
|
|
|
|
|
|
*PRINTF = \&printf; |
650
|
|
|
|
|
|
|
*WRITE = \&syswrite; |
651
|
|
|
|
|
|
|
*write = \&syswrite; |
652
|
|
|
|
|
|
|
*TELL = \&tell; |
653
|
|
|
|
|
|
|
*EOF = \&eof; |
654
|
|
|
|
|
|
|
*CLOSE = \&close; |
655
|
|
|
|
|
|
|
*BINMODE = \&binmode; |
656
|
|
|
|
|
|
|
} |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
#{ |
659
|
|
|
|
|
|
|
# package Archive::Zip::SimpleZip::HandleNEW ; |
660
|
|
|
|
|
|
|
# |
661
|
|
|
|
|
|
|
## TODO - fix this |
662
|
|
|
|
|
|
|
## require Tie::Handle; |
663
|
|
|
|
|
|
|
## |
664
|
|
|
|
|
|
|
## @ISA = qw(Tie::Handle); |
665
|
|
|
|
|
|
|
##@ISA = qw(IO::Handle) ; |
666
|
|
|
|
|
|
|
# |
667
|
|
|
|
|
|
|
# sub TIEHANDLE |
668
|
|
|
|
|
|
|
# { |
669
|
|
|
|
|
|
|
# my $class = shift; |
670
|
|
|
|
|
|
|
# my $parent = shift; |
671
|
|
|
|
|
|
|
# my $zip = shift; |
672
|
|
|
|
|
|
|
# my $errorRef = shift; |
673
|
|
|
|
|
|
|
# |
674
|
|
|
|
|
|
|
# my %obj = ( |
675
|
|
|
|
|
|
|
# Zip => $zip , |
676
|
|
|
|
|
|
|
# SZ => $parent, |
677
|
|
|
|
|
|
|
# Open => 1, |
678
|
|
|
|
|
|
|
# ) ; |
679
|
|
|
|
|
|
|
# |
680
|
|
|
|
|
|
|
# Scalar::Util::weaken $obj{SZ}; # for 5.8 |
681
|
|
|
|
|
|
|
# return bless \%obj, $class; |
682
|
|
|
|
|
|
|
# } |
683
|
|
|
|
|
|
|
# |
684
|
|
|
|
|
|
|
# sub UNTIE |
685
|
|
|
|
|
|
|
# { |
686
|
|
|
|
|
|
|
# my $self = shift ; |
687
|
|
|
|
|
|
|
# } |
688
|
|
|
|
|
|
|
# |
689
|
|
|
|
|
|
|
# sub DESTROY |
690
|
|
|
|
|
|
|
# { |
691
|
|
|
|
|
|
|
# my $self = shift ; |
692
|
|
|
|
|
|
|
# local ($., $@, $!, $^E, $?); |
693
|
|
|
|
|
|
|
# $self->close() ; |
694
|
|
|
|
|
|
|
# |
695
|
|
|
|
|
|
|
# # TODO - memory leak with 5.8.0 - this isn't called until |
696
|
|
|
|
|
|
|
# # global destruction |
697
|
|
|
|
|
|
|
# # |
698
|
|
|
|
|
|
|
# %{ $self } = () ; |
699
|
|
|
|
|
|
|
# undef $self ; |
700
|
|
|
|
|
|
|
# } |
701
|
|
|
|
|
|
|
# |
702
|
|
|
|
|
|
|
# sub close |
703
|
|
|
|
|
|
|
# { |
704
|
|
|
|
|
|
|
# my $self = shift ; |
705
|
|
|
|
|
|
|
# return 1 if ! $self->{Open}; |
706
|
|
|
|
|
|
|
# |
707
|
|
|
|
|
|
|
# $self->{Open} = 0 ; |
708
|
|
|
|
|
|
|
# |
709
|
|
|
|
|
|
|
## untie *$self |
710
|
|
|
|
|
|
|
## if $] >= 5.008 ; |
711
|
|
|
|
|
|
|
# |
712
|
|
|
|
|
|
|
# if (defined $self->{SZ}) |
713
|
|
|
|
|
|
|
# { |
714
|
|
|
|
|
|
|
# $self->{SZ}{Raw} = undef ; |
715
|
|
|
|
|
|
|
# $self->{SZ} = undef ; |
716
|
|
|
|
|
|
|
# } |
717
|
|
|
|
|
|
|
# |
718
|
|
|
|
|
|
|
# 1; |
719
|
|
|
|
|
|
|
# } |
720
|
|
|
|
|
|
|
# |
721
|
|
|
|
|
|
|
# sub print |
722
|
|
|
|
|
|
|
# { |
723
|
|
|
|
|
|
|
# my $self = shift; |
724
|
|
|
|
|
|
|
# $self->_stdPreq() or return 0 ; |
725
|
|
|
|
|
|
|
# |
726
|
|
|
|
|
|
|
# $self->{Zip}->print(@_); |
727
|
|
|
|
|
|
|
# } |
728
|
|
|
|
|
|
|
# |
729
|
|
|
|
|
|
|
# sub printf |
730
|
|
|
|
|
|
|
# { |
731
|
|
|
|
|
|
|
# my $self = shift; |
732
|
|
|
|
|
|
|
# $self->_stdPreq() or return 0 ; |
733
|
|
|
|
|
|
|
# |
734
|
|
|
|
|
|
|
# $self->{Zip}->printf(@_); |
735
|
|
|
|
|
|
|
# } |
736
|
|
|
|
|
|
|
# |
737
|
|
|
|
|
|
|
# sub syswrite |
738
|
|
|
|
|
|
|
# { |
739
|
|
|
|
|
|
|
# my $self = shift; |
740
|
|
|
|
|
|
|
# $self->_stdPreq() or return 0 ; |
741
|
|
|
|
|
|
|
# |
742
|
|
|
|
|
|
|
# $self->{Zip}->syswrite(@_); |
743
|
|
|
|
|
|
|
# } |
744
|
|
|
|
|
|
|
# |
745
|
|
|
|
|
|
|
# sub tell |
746
|
|
|
|
|
|
|
# { |
747
|
|
|
|
|
|
|
# my $self = shift; |
748
|
|
|
|
|
|
|
# $self->_stdPreq() or return 0 ; |
749
|
|
|
|
|
|
|
# |
750
|
|
|
|
|
|
|
# $self->{Zip}->tell(@_); |
751
|
|
|
|
|
|
|
# } |
752
|
|
|
|
|
|
|
# |
753
|
|
|
|
|
|
|
# sub eof |
754
|
|
|
|
|
|
|
# { |
755
|
|
|
|
|
|
|
# my $self = shift; |
756
|
|
|
|
|
|
|
# $self->_stdPreq() or return 0 ; |
757
|
|
|
|
|
|
|
# |
758
|
|
|
|
|
|
|
# $self->{Zip}->eof; |
759
|
|
|
|
|
|
|
# } |
760
|
|
|
|
|
|
|
# |
761
|
|
|
|
|
|
|
# sub _stdPreq |
762
|
|
|
|
|
|
|
# { |
763
|
|
|
|
|
|
|
# my $self = shift; |
764
|
|
|
|
|
|
|
# |
765
|
|
|
|
|
|
|
# return _setError("Zip file closed") |
766
|
|
|
|
|
|
|
# if ! defined defined $self->{SZ} || ! $self->{SZ}{Open} ; |
767
|
|
|
|
|
|
|
# |
768
|
|
|
|
|
|
|
# |
769
|
|
|
|
|
|
|
# return _setError("openMember filehandle closed") |
770
|
|
|
|
|
|
|
# if ! $self->{Open} || ! defined $self->{SZ}{Raw}; |
771
|
|
|
|
|
|
|
# |
772
|
|
|
|
|
|
|
# return 0 |
773
|
|
|
|
|
|
|
# if $self->{SZ}{Error} ; |
774
|
|
|
|
|
|
|
# |
775
|
|
|
|
|
|
|
# return 1; |
776
|
|
|
|
|
|
|
# } |
777
|
|
|
|
|
|
|
# |
778
|
|
|
|
|
|
|
# sub _setError |
779
|
|
|
|
|
|
|
# { |
780
|
|
|
|
|
|
|
# $Archive::Zip::SimpleZip::SimpleZipError = $_[0] ; |
781
|
|
|
|
|
|
|
# return 0; |
782
|
|
|
|
|
|
|
# } |
783
|
|
|
|
|
|
|
# |
784
|
|
|
|
|
|
|
# sub binmode { 1 } |
785
|
|
|
|
|
|
|
## sub clearerr { $Archive::Zip::SimpleZip::SimpleZipError = '' } |
786
|
|
|
|
|
|
|
# |
787
|
|
|
|
|
|
|
# *FILENO = \&fileno; |
788
|
|
|
|
|
|
|
# *PRINT = \&print; |
789
|
|
|
|
|
|
|
# *PRINTF = \&printf; |
790
|
|
|
|
|
|
|
# *WRITE = \&syswrite; |
791
|
|
|
|
|
|
|
# *write = \&syswrite; |
792
|
|
|
|
|
|
|
# *TELL = \&tell; |
793
|
|
|
|
|
|
|
## sub IO::Handle::tell { bless $_[0], "Archive::Zip::SimpleZip::Handle" ; Archive::Zip::SimpleZip::Handle::tell @_ }; |
794
|
|
|
|
|
|
|
# *EOF = \&eof; |
795
|
|
|
|
|
|
|
# *CLOSE = \&close; |
796
|
|
|
|
|
|
|
# *BINMODE = \&binmode; |
797
|
|
|
|
|
|
|
#} |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
1; |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
__END__ |