line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Compress::LZW; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Compress::LZW::VERSION = '0.03'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Pure-Perl implementation of scaling LZW |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
77045
|
use strictures; |
|
4
|
|
|
|
|
3732
|
|
|
4
|
|
|
|
|
22
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
294
|
use base 'Exporter'; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
736
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
4
|
|
|
4
|
|
127
|
our @EXPORT = qw/compress decompress/; |
14
|
4
|
|
|
|
|
18
|
our @EXPORT_OK = qw( $MAGIC $BITS_MASK $BLOCK_MASK $RESET_CODE ); |
15
|
4
|
|
|
|
|
296
|
our %EXPORT_TAGS = ( |
16
|
|
|
|
|
|
|
const => \@EXPORT_OK, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $MAGIC = "\037\235"; |
21
|
|
|
|
|
|
|
our $BITS_MASK = 0x1f; |
22
|
|
|
|
|
|
|
our $BLOCK_MASK = 0x80; |
23
|
|
|
|
|
|
|
our $RESET_CODE = 256; |
24
|
|
|
|
|
|
|
|
25
|
4
|
|
|
4
|
|
2057
|
use Compress::LZW::Compressor; |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
155
|
|
26
|
4
|
|
|
4
|
|
2741
|
use Compress::LZW::Decompressor; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
770
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub compress { |
30
|
3
|
|
|
3
|
1
|
4898
|
my ( $str ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
74
|
return Compress::LZW::Compressor->new()->compress( $str ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub decompress { |
38
|
3
|
|
|
3
|
1
|
23412
|
my ( $str ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
3
|
|
|
|
|
54
|
return Compress::LZW::Decompressor->new()->decompress( $str ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _detect_lsb_first { |
45
|
4
|
|
|
4
|
|
47
|
use Config; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
479
|
|
46
|
|
|
|
|
|
|
|
47
|
17
|
50
|
|
17
|
|
10267
|
return 1 if substr($Config{byteorder},0,4) eq '1234'; |
48
|
0
|
|
|
|
|
|
return 0; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |