line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Archive::SevenZip::Entry; |
2
|
10
|
|
|
10
|
|
71
|
use strict; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
302
|
|
3
|
|
|
|
|
|
|
|
4
|
10
|
|
|
10
|
|
6135
|
use Archive::Zip::Member; |
|
10
|
|
|
|
|
785451
|
|
|
10
|
|
|
|
|
782
|
|
5
|
10
|
|
|
10
|
|
5324
|
use Time::Piece; # for strptime |
|
10
|
|
|
|
|
71545
|
|
|
10
|
|
|
|
|
48
|
|
6
|
10
|
|
|
10
|
|
788
|
use File::Basename (); |
|
10
|
|
|
|
|
29
|
|
|
10
|
|
|
|
|
163
|
|
7
|
10
|
|
|
10
|
|
4424
|
use Path::Class (); |
|
10
|
|
|
|
|
180559
|
|
|
10
|
|
|
|
|
4852
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION= '0.16'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
0
|
|
my( $class, %options) = @_; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
bless \%options => $class |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub archive { |
18
|
|
|
|
|
|
|
$_[0]->{_Container} |
19
|
0
|
|
|
0
|
0
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub fileName { |
22
|
0
|
|
|
0
|
0
|
|
my( $self ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $res = $self->{Path}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Normalize to unixy path names |
27
|
0
|
|
|
|
|
|
$res =~ s!\\!/!g; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# If we're a directory, append the slash: |
30
|
0
|
0
|
|
|
|
|
if( $self->{Folder} eq '+') { |
31
|
0
|
|
|
|
|
|
$res .= '/'; |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$res |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Class::Path API |
38
|
|
|
|
|
|
|
sub basename { |
39
|
0
|
|
|
0
|
0
|
|
Path::Class::file( $_[0]->{Path} )->basename |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub components { |
43
|
0
|
|
|
0
|
0
|
|
my $cp = file( $_[0]->{Path} ); |
44
|
0
|
|
|
|
|
|
$cp->components() |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub lastModTime { |
48
|
0
|
|
|
0
|
0
|
|
(my $dt = $_[0]->{Modified}) =~ s/\.\d+$//; |
49
|
0
|
|
|
|
|
|
Time::Piece->strptime($dt, '%Y-%m-%d %H:%M:%S')->epoch; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub lastModFileDateTime { |
53
|
0
|
|
|
0
|
0
|
|
Archive::Zip::Member::_unixToDosTime($_[0]->lastModTime()) |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub crc32 { |
57
|
0
|
|
|
0
|
0
|
|
hex( $_[0]->{CRC} ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub crc32String { |
61
|
0
|
|
|
0
|
0
|
|
lc $_[0]->{CRC}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub desiredCompressionMethod { |
65
|
|
|
|
|
|
|
$_[0]->{Method} |
66
|
0
|
|
|
0
|
0
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub uncompressedSize { |
69
|
|
|
|
|
|
|
$_[0]->{Size} |
70
|
0
|
|
|
0
|
0
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub dir { |
73
|
|
|
|
|
|
|
# We need to return the appropriate class here |
74
|
|
|
|
|
|
|
# so that further calls to (like) dir->list |
75
|
|
|
|
|
|
|
# still work properly |
76
|
0
|
|
|
0
|
0
|
|
die "->dir Not implemented"; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub open { |
80
|
0
|
|
|
0
|
0
|
|
my( $self, $mode, $permissions )= @_; |
81
|
0
|
|
|
|
|
|
$self->archive->openMemberFH( membername => $self->fileName, binmode => $mode ); |
82
|
|
|
|
|
|
|
} |
83
|
10
|
|
|
10
|
|
99
|
{ no warnings 'once'; |
|
10
|
|
|
|
|
37
|
|
|
10
|
|
|
|
|
1799
|
|
84
|
|
|
|
|
|
|
*fh = \&open; # Archive::Zip API |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# Path::Class API |
88
|
|
|
|
|
|
|
sub slurp { |
89
|
0
|
|
|
0
|
0
|
|
my( $self, %options )= @_; |
90
|
0
|
|
|
|
|
|
my $fh = $self->archive->openMemberFH( membername => $self->fileName, binmode => $options{ iomode } ); |
91
|
0
|
|
|
|
|
|
local $/; |
92
|
|
|
|
|
|
|
<$fh> |
93
|
0
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Archive::Zip API |
96
|
|
|
|
|
|
|
#externalFileName() |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# Archive::Zip API |
99
|
|
|
|
|
|
|
#fileName() |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# Archive::Zip API |
102
|
|
|
|
|
|
|
#lastModFileDateTime() |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Archive::Zip API |
105
|
|
|
|
|
|
|
#lastModTime() |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# Archive::Zip API |
108
|
|
|
|
|
|
|
sub extractToFileNamed { |
109
|
0
|
|
|
0
|
0
|
|
my($self, $target) = @_; |
110
|
0
|
|
|
|
|
|
$self->archive->extractMember( $self->fileName, $target ); |
111
|
|
|
|
|
|
|
}; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 REPOSITORY |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
The public repository of this module is |
118
|
|
|
|
|
|
|
L. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SUPPORT |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
The public support forum of this module is |
123
|
|
|
|
|
|
|
L. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 BUG TRACKER |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Please report bugs in this module via the RT CPAN bug queue at |
128
|
|
|
|
|
|
|
L |
129
|
|
|
|
|
|
|
or via mail to L. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 AUTHOR |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Max Maischein C |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT (c) |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Copyright 2015-2019 by Max Maischein C. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 LICENSE |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This module is released under the same terms as Perl itself. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |