| 1 | package Archive::Zip::Parser::Entry::Header; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Data::ParseBinary; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | sub get_signature { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_signature: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | return unpack( 'H*', pack( 'N', $self->{'_signature'} ) ); | |||||||||||||||||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | sub get_version_needed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_version_needed: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | my ( $self, $argref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | my $version_needed = | ||||||||||||||||||||||||||||||||||||||||||
| 16 | int( $self->{'_version_needed'} / 10 ) . '.' | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | . $self->{'_version_needed'} % 10; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | ▶ | if ( $argref->{'describe'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | my %version_description_mapping = ( | |||||||||||||||||||||||||||||||||||||||||
| 20 | '1.0' => 'Default value', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | '1.1' => 'File is a volume label', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | '2.0' => join( ', ', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 'File is a folder (directory)', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 'File is compressed using Deflate compression', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 'File is encrypted using traditional PKWARE encryption', | ||||||||||||||||||||||||||||||||||||||||||
| 26 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 27 | '2.1' => 'File is compressed using Deflate64(tm)', | ||||||||||||||||||||||||||||||||||||||||||
| 28 | '2.5' => 'File is compressed using PKWARE DCL Implode ', | ||||||||||||||||||||||||||||||||||||||||||
| 29 | '2.7' => 'File is a patch data set ', | ||||||||||||||||||||||||||||||||||||||||||
| 30 | '4.5' => 'File uses ZIP64 format extensions', | ||||||||||||||||||||||||||||||||||||||||||
| 31 | '4.6' => 'File is compressed using BZIP2 compression*', | ||||||||||||||||||||||||||||||||||||||||||
| 32 | '5.0' => join( ', ', | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 'File is encrypted using DES', | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 'File is encrypted using 3DES', | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 'File is encrypted using original RC2 encryption', | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 'File is encrypted using RC4 encryption', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 38 | '5.1' => join( ', ', | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 'File is encrypted using AES encryption', | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 'File is encrypted using corrected RC2 encryption', | ||||||||||||||||||||||||||||||||||||||||||
| 41 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 42 | '5.2' => 'File is encrypted using corrected RC2-64 encryption', | ||||||||||||||||||||||||||||||||||||||||||
| 43 | '6.1' => 'File is encrypted using non-OAEP key wrapping', | ||||||||||||||||||||||||||||||||||||||||||
| 44 | '6.2' => 'Central directory encryption', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | '6.3' => join( ', ', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 'File is compressed using LZMA', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 'File is compressed using PPMd', | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 'File is encrypted using Blowfish', | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 'File is encrypted using Twofish', | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 2 | return $version_description_mapping{$version_needed}; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | return $version_needed; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | ▶ | sub get_gp_bit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_gp_bit: called CC=29 SCAR=57.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | my ( $self, $argref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | my @bits; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 4 | for ( 0 .. 15 ) { | |||||||||||||||||||||||||||||||||||||||||
| 63 | 64 | push @bits, $self->{'_gp_bit'}->{"_bit_$_"}; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | ▶ | if ( $argref->{'describe'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | my @gp_bit_descriptions; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | if ( $bits[0] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | push @gp_bit_descriptions, 'File is encrypted'; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | ▶ | if ( $self->{'_compression_method'} == 6 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if ( $bits[1] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | push @gp_bit_descriptions, '8K sliding dictionary'; | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | push @gp_bit_descriptions, '4K sliding dictionary'; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ( $bits[2] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 82 | '3 Shannon-Fano trees were used to encode the sliding dictionary output'; | ||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 86 | '2 Shannon-Fano trees were used to encode the sliding dictionary output'; | ||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | elsif ( $self->{'_compression_method'} == 8 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | if ( $self->{'_compression_method'} == 9 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if ( !$bits[2] && !$bits[1] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
$bits[2] || $bits[1]
MC/DC0%0/2
$bits[2] || $bits[1]
$bits[2]
$bits[1]
Truth table0%0/3
A || B
A= $bits[2]B= $bits[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 93 | 'Normal (-en) compression option was used'; | ||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | ▶ | elsif ( !$bits[2] && $bits[1] ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $bits[2] and $bits[1]
MC/DC0%0/2
not $bits[2] and $bits[1]
not $bits[2]
$bits[1]
Truth table0%0/3
not(A) and B
A= not $bits[2]B= $bits[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 97 | 'Maximum (-exx/-ex) compression option was used'; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | ▶ | elsif ( $bits[2] && !$bits[1] ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$bits[2] and not $bits[1]
MC/DC0%0/2
$bits[2] and not $bits[1]
$bits[2]
not $bits[1]
Truth table0%0/3
A and not(B)
A= $bits[2]B= not $bits[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 101 | 'Fast (-ef) compression option was used'; | ||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | ▶ | elsif ( $bits[2] && $bits[1] ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$bits[2] and $bits[1]
MC/DC0%0/2
$bits[2] and $bits[1]
$bits[2]
$bits[1]
Truth table0%0/3
A and B
A= $bits[2]B= $bits[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 105 | 'Super Fast (-es) compression option was used'; | ||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ( $bits[4] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | push @gp_bit_descriptions, 'Enhanced deflating'; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | elsif ( $self->{'_compression_method'} == 14 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if ( $bits[1] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 116 | 'End-of-stream (EOS) marker is used to mark the end of the compressed data stream'; | ||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 120 | 'End-of-stream (EOS) marker is not present and the compressed data size must be known to extract'; | ||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | ▶ | if ( $bits[3] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 126 | 'Data descriptor contains CRC-32, compressed size and uncompressed size'; | ||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 2 | ▶ | if ( $bits[5] && $self->{'_version_needed'} >= 27 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$bits[5] and $self->{"_version_needed"} >= 27
MC/DC0%0/2
$bits[5] and $self->{"_version_needed"} >= 27
$bits[5]
$self->{"_version_needed"} >= 27
Truth table33%1/3
A and B
A= $bits[5]B= $self->{"_version_needed"} >= 27
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | push @gp_bit_descriptions, 'Compressed patched data'; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | ▶ | if ( $bits[6] && $self->{'_version_needed'} >= 50 && $bits[0] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$bits[6] and $self->{"_version_needed"} >= 50 and $bits[0]
$bits[6] and $self->{"_version_needed"} >= 50
MC/DC0%0/3
$bits[6] and $self->{"_version_needed"} >= 50 and $bits[0]
$bits[6]
$self->{"_version_needed"} >= 50
$bits[0]
Truth table25%1/4
A and B and C
A= $bits[6]B= $self->{"_version_needed"} >= 50C= $bits[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | push @gp_bit_descriptions, 'Strong encryption'; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | ▶ | if ( $bits[11] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 139 | 'Filename and comment fields are encoded using UTF-8'; | ||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | if ( $bits[12] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | push @gp_bit_descriptions, 'Enhanced compression'; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 2 | ▶ | if ( $bits[13] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | push @gp_bit_descriptions, | |||||||||||||||||||||||||||||||||||||||||
| 147 | 'Selected data values in the Local Header are masked'; | ||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | return @gp_bit_descriptions; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | return @bits; | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | ▶ | sub get_compression_method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_compression_method: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 4 | my ( $self, $argref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 4 | ▶ | if ( $argref->{'describe'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 2 | my %compression_method_description_mapping = ( | |||||||||||||||||||||||||||||||||||||||||
| 161 | '0' => 'The file is stored (no compression)', | ||||||||||||||||||||||||||||||||||||||||||
| 162 | '1' => 'The file is Shrunk', | ||||||||||||||||||||||||||||||||||||||||||
| 163 | '2' => 'The file is Reduced with compression factor 1', | ||||||||||||||||||||||||||||||||||||||||||
| 164 | '3' => 'The file is Reduced with compression factor 2', | ||||||||||||||||||||||||||||||||||||||||||
| 165 | '4' => 'The file is Reduced with compression factor 3', | ||||||||||||||||||||||||||||||||||||||||||
| 166 | '5' => 'The file is Reduced with compression factor 4', | ||||||||||||||||||||||||||||||||||||||||||
| 167 | '6' => 'The file is Imploded', | ||||||||||||||||||||||||||||||||||||||||||
| 168 | '7' => 'Reserved for Tokenizing compression algorithm', | ||||||||||||||||||||||||||||||||||||||||||
| 169 | '8' => 'The file is Deflated', | ||||||||||||||||||||||||||||||||||||||||||
| 170 | '9' => 'Enhanced Deflating using Deflate64(tm)', | ||||||||||||||||||||||||||||||||||||||||||
| 171 | '10' => 'PKWARE Data Compression Library Imploding (old IBM TERSE)', | ||||||||||||||||||||||||||||||||||||||||||
| 172 | '11' => 'Reserved by PKWARE', | ||||||||||||||||||||||||||||||||||||||||||
| 173 | '12' => 'File is compressed using BZIP2 algorithm', | ||||||||||||||||||||||||||||||||||||||||||
| 174 | '13' => 'Reserved by PKWARE', | ||||||||||||||||||||||||||||||||||||||||||
| 175 | '14' => 'LZMA (EFS)', | ||||||||||||||||||||||||||||||||||||||||||
| 176 | '15' => 'Reserved by PKWARE', | ||||||||||||||||||||||||||||||||||||||||||
| 177 | '16' => 'Reserved by PKWARE', | ||||||||||||||||||||||||||||||||||||||||||
| 178 | '17' => 'Reserved by PKWARE', | ||||||||||||||||||||||||||||||||||||||||||
| 179 | '18' => 'File is compressed using IBM TERSE (new)', | ||||||||||||||||||||||||||||||||||||||||||
| 180 | '19' => 'IBM LZ77 z Architecture (PFS)', | ||||||||||||||||||||||||||||||||||||||||||
| 181 | '97' => 'WavPack compressed data', | ||||||||||||||||||||||||||||||||||||||||||
| 182 | '98' => 'PPMd version I, Rev 1', | ||||||||||||||||||||||||||||||||||||||||||
| 183 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 2 | return $compression_method_description_mapping{ $self->{'_compression_method'} }; | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 2 | return $self->{'_compression_method'}; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 2 | ▶ | sub get_last_mod_time { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_last_mod_time: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | my $last_mod_time = pack 'n', $self->{'_last_mod_time'}; | |||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 2 | my $last_mod_time_struct = BitStruct( | |||||||||||||||||||||||||||||||||||||||||
| 196 | 'last_mod_time', | ||||||||||||||||||||||||||||||||||||||||||
| 197 | BitField( 'hour', 5 ), | ||||||||||||||||||||||||||||||||||||||||||
| 198 | BitField( 'minute', 6 ), | ||||||||||||||||||||||||||||||||||||||||||
| 199 | BitField( 'second', 5 ), | ||||||||||||||||||||||||||||||||||||||||||
| 200 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 2 | my $parsed_last_mod_time_struct | |||||||||||||||||||||||||||||||||||||||||
| 202 | = $last_mod_time_struct->parse($last_mod_time); | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 2 | return %{$parsed_last_mod_time_struct}; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | ▶ | sub get_last_mod_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_last_mod_date: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | my $last_mod_date = pack 'n', $self->{'_last_mod_date'}; | |||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | my $last_mod_date_struct = BitStruct( | |||||||||||||||||||||||||||||||||||||||||
| 212 | 'last_mod_date', | ||||||||||||||||||||||||||||||||||||||||||
| 213 | BitField( 'year', 7 ), | ||||||||||||||||||||||||||||||||||||||||||
| 214 | BitField( 'month', 4 ), | ||||||||||||||||||||||||||||||||||||||||||
| 215 | BitField( 'day', 5 ), | ||||||||||||||||||||||||||||||||||||||||||
| 216 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 2 | my $parsed_last_mod_date_struct | |||||||||||||||||||||||||||||||||||||||||
| 218 | = $last_mod_date_struct->parse($last_mod_date); | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | $parsed_last_mod_date_struct->{'year'} += 1980; | |||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | return %{$parsed_last_mod_date_struct}; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | ▶ | sub get_crc_32 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_crc_32: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 2 | return unpack( 'H*', pack( 'N', $self->{'_crc_32'} ) ); | |||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 2 | ▶ | sub get_compressed_size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_compressed_size: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 231 | 2 | return $self->{'_compressed_size'}; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 2 | ▶ | sub get_uncompressed_size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_uncompressed_size: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 2 | return $self->{'_uncompressed_size'}; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | ▶ | sub get_file_name_length { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_file_name_length: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 2 | return $self->{'_file_name_length'}; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | ▶ | sub get_extra_field_length { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_extra_field_length: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 2 | return $self->{'_extra_field_length'}; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 2 | ▶ | sub get_file_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_file_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 2 | return $self->{'_file_name'}; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 4 | ▶ | sub get_extra_field { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_extra_field: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 4 | my ( $self, $argref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | my $extra_field | ||||||||||||||||||||||||||||||||||||||||||
| 258 | = Struct( | ||||||||||||||||||||||||||||||||||||||||||
| 259 | '_extra_field', | ||||||||||||||||||||||||||||||||||||||||||
| 260 | RepeatUntil( | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 8 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 8 | $_->obj->{'_position'} == $self->{'_extra_field_length'}; | |||||||||||||||||||||||||||||||||||||||||
| 263 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 264 | Struct( | ||||||||||||||||||||||||||||||||||||||||||
| 265 | '_header', | ||||||||||||||||||||||||||||||||||||||||||
| 266 | ULInt16('_id'), | ||||||||||||||||||||||||||||||||||||||||||
| 267 | ULInt16('_size'), | ||||||||||||||||||||||||||||||||||||||||||
| 268 | Field( | ||||||||||||||||||||||||||||||||||||||||||
| 269 | '_data', | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 8 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 8 | $_->ctx->{'_size'} | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | ), | |||||||||||||||||||||||||||||||||||||||||
| 274 | Anchor('_position'), | ||||||||||||||||||||||||||||||||||||||||||
| 275 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 276 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 277 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 4 | my $parsed_extra_field = $extra_field->parse( $self->{'_extra_field'} ); | |||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 4 | ▶ | if ( $argref->{'describe'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | my %extra_field_description_mapping = ( | |||||||||||||||||||||||||||||||||||||||||
| 282 | '0001' => 'Zip64 extended information extra field', | ||||||||||||||||||||||||||||||||||||||||||
| 283 | '0007' => 'AV Info', | ||||||||||||||||||||||||||||||||||||||||||
| 284 | '0008' => 'Reserved for extended language encoding data (PFS)', | ||||||||||||||||||||||||||||||||||||||||||
| 285 | '0009' => 'OS/2', | ||||||||||||||||||||||||||||||||||||||||||
| 286 | '000a' => 'NTFS ', | ||||||||||||||||||||||||||||||||||||||||||
| 287 | '000c' => 'OpenVMS', | ||||||||||||||||||||||||||||||||||||||||||
| 288 | '000d' => 'UNIX', | ||||||||||||||||||||||||||||||||||||||||||
| 289 | '000e' => 'Reserved for file stream and fork descriptors', | ||||||||||||||||||||||||||||||||||||||||||
| 290 | '000f' => 'Patch Descriptor', | ||||||||||||||||||||||||||||||||||||||||||
| 291 | '0014' => 'PKCS#7 Store for X.509 Certificates', | ||||||||||||||||||||||||||||||||||||||||||
| 292 | '0015' => 'X.509 Certificate ID and Signature for individual file', | ||||||||||||||||||||||||||||||||||||||||||
| 293 | '0016' => 'X.509 Certificate ID for Central Directory', | ||||||||||||||||||||||||||||||||||||||||||
| 294 | '0017' => 'Strong Encryption Header', | ||||||||||||||||||||||||||||||||||||||||||
| 295 | '0018' => 'Record Management Controls', | ||||||||||||||||||||||||||||||||||||||||||
| 296 | '0019' => 'PKCS#7 Encryption Recipient Certificate List', | ||||||||||||||||||||||||||||||||||||||||||
| 297 | '0065' => | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 'IBM S/390 (Z390), AS/400 (I400) attributes - uncompressed', | ||||||||||||||||||||||||||||||||||||||||||
| 299 | '0066' => | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 'Reserved for IBM S/390 (Z390), AS/400 (I400) attributes - compressed', | ||||||||||||||||||||||||||||||||||||||||||
| 301 | '4690' => 'POSZIP 4690 (reserved) ', | ||||||||||||||||||||||||||||||||||||||||||
| 302 | '07c8' => 'Macintosh', | ||||||||||||||||||||||||||||||||||||||||||
| 303 | '2605' => 'ZipIt Macintosh', | ||||||||||||||||||||||||||||||||||||||||||
| 304 | '2705' => 'ZipIt Macintosh 1.3.5+', | ||||||||||||||||||||||||||||||||||||||||||
| 305 | '2805' => 'ZipIt Macintosh 1.3.5+', | ||||||||||||||||||||||||||||||||||||||||||
| 306 | '334d' => 'Info-ZIP Macintosh', | ||||||||||||||||||||||||||||||||||||||||||
| 307 | '4341' => 'Acorn/SparkFS ', | ||||||||||||||||||||||||||||||||||||||||||
| 308 | '4453' => 'Windows NT security descriptor (binary ACL)', | ||||||||||||||||||||||||||||||||||||||||||
| 309 | '4704' => 'VM/CMS', | ||||||||||||||||||||||||||||||||||||||||||
| 310 | '470f' => 'MVS', | ||||||||||||||||||||||||||||||||||||||||||
| 311 | '4b46' => 'FWKCS MD5', | ||||||||||||||||||||||||||||||||||||||||||
| 312 | '4c41' => 'OS/2 access control list (text ACL)', | ||||||||||||||||||||||||||||||||||||||||||
| 313 | '4d49' => 'Info-ZIP OpenVMS', | ||||||||||||||||||||||||||||||||||||||||||
| 314 | '4f4c' => 'Xceed original location extra field', | ||||||||||||||||||||||||||||||||||||||||||
| 315 | '5356' => 'AOS/VS (ACL)', | ||||||||||||||||||||||||||||||||||||||||||
| 316 | '5455' => 'extended timestamp', | ||||||||||||||||||||||||||||||||||||||||||
| 317 | '554e' => 'Xceed unicode extra field', | ||||||||||||||||||||||||||||||||||||||||||
| 318 | '5855' => 'Info-ZIP UNIX (original, also OS/2, NT, etc)', | ||||||||||||||||||||||||||||||||||||||||||
| 319 | '6375' => 'Info-ZIP Unicode Comment Extra Field', | ||||||||||||||||||||||||||||||||||||||||||
| 320 | '6542' => 'BeOS/BeBox', | ||||||||||||||||||||||||||||||||||||||||||
| 321 | '7075' => 'Info-ZIP Unicode Path Extra Field', | ||||||||||||||||||||||||||||||||||||||||||
| 322 | '756e' => 'ASi UNIX', | ||||||||||||||||||||||||||||||||||||||||||
| 323 | '7855' => 'Info-ZIP UNIX (new)', | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 'a220' => 'Microsoft Open Packaging Growth Hint', | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 'fd4a' => 'SMS/QDOS', | ||||||||||||||||||||||||||||||||||||||||||
| 326 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 2 | my %extra_field_descriptions; | |||||||||||||||||||||||||||||||||||||||||
| 329 | my @descriptions_to_be_serialised; | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 2 | for ( @{ $parsed_extra_field->{'_header'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 331 | 4 | my $id = unpack( 'H*', pack( 'n', $_->{'_id'} ) ); | |||||||||||||||||||||||||||||||||||||||||
| 332 | 4 | my $data = unpack( 'H*', $_->{'_data'} ); | |||||||||||||||||||||||||||||||||||||||||
| 333 | 4 | my @serialised_extra_field_description; | |||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 4 | ▶ | if ( exists $extra_field_description_mapping{$id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 2 | my $description = $extra_field_description_mapping{$id}; | |||||||||||||||||||||||||||||||||||||||||
| 337 | 2 | $extra_field_descriptions{$description} = $data; | |||||||||||||||||||||||||||||||||||||||||
| 338 | 2 | push @descriptions_to_be_serialised, $description; | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 2 | $extra_field_descriptions{$id} = $data; | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | return %extra_field_descriptions; | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 2 | my %extra_field; | |||||||||||||||||||||||||||||||||||||||||
| 349 | 2 | for ( @{ $parsed_extra_field->{'_header'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 350 | 4 | my $id = unpack( 'H*', pack( 'n', $_->{'_id'} ) ); | |||||||||||||||||||||||||||||||||||||||||
| 351 | 4 | my $data = unpack( 'H*', $_->{'_data'} ); | |||||||||||||||||||||||||||||||||||||||||
| 352 | 4 | $extra_field{$id} = $data; | |||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 2 | return %extra_field; | |||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||