line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Compress::LZW; |
2
|
|
|
|
|
|
|
# ABSTRACT: Pure-Perl implementation of scaling LZW |
3
|
|
|
|
|
|
|
$Compress::LZW::VERSION = '0.04'; |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
36713
|
use strictures; |
|
4
|
|
|
|
|
2762
|
|
|
4
|
|
|
|
|
18
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
288
|
use base 'Exporter'; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
644
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
4
|
|
|
4
|
|
13
|
our @EXPORT = qw/compress decompress/; |
11
|
4
|
|
|
|
|
25
|
our @EXPORT_OK = qw( |
12
|
|
|
|
|
|
|
$MAGIC $MASK_BITS $MASK_BLOCK |
13
|
|
|
|
|
|
|
$RESET_CODE $BL_INIT_CODE $NR_INIT_CODE |
14
|
|
|
|
|
|
|
$INIT_CODE_SIZE |
15
|
|
|
|
|
|
|
); |
16
|
4
|
|
|
|
|
330
|
our %EXPORT_TAGS = ( |
17
|
|
|
|
|
|
|
const => \@EXPORT_OK, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $MAGIC = "\037\235"; |
22
|
|
|
|
|
|
|
our $MASK_BITS = 0x1f; |
23
|
|
|
|
|
|
|
our $MASK_BLOCK = 0x80; |
24
|
|
|
|
|
|
|
our $RESET_CODE = 256; |
25
|
|
|
|
|
|
|
our $BL_INIT_CODE = 257; |
26
|
|
|
|
|
|
|
our $NR_INIT_CODE = 256; |
27
|
|
|
|
|
|
|
our $INIT_CODE_SIZE = 9; |
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
4
|
|
729
|
use Compress::LZW::Compressor; |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
107
|
|
30
|
4
|
|
|
4
|
|
1564
|
use Compress::LZW::Decompressor; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
444
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub compress { |
34
|
4
|
|
|
4
|
1
|
2834
|
my ( $str ) = @_; |
35
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
73
|
return Compress::LZW::Compressor->new()->compress( $str ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub decompress { |
42
|
4
|
|
|
4
|
1
|
7
|
my ( $str ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
38
|
return Compress::LZW::Decompressor->new()->decompress( $str ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |