line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gzip::Zopfli; |
2
|
2
|
|
|
2
|
|
144388
|
use warnings; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
68
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
37
|
|
4
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
125
|
|
5
|
2
|
|
|
2
|
|
13
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
32
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
9
|
|
|
|
|
|
|
zopfli_compress |
10
|
|
|
|
|
|
|
zopfli_compress_file |
11
|
|
|
|
|
|
|
/; |
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
13
|
|
|
|
|
|
|
all => \@EXPORT_OK, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
16
|
|
|
|
|
|
|
require XSLoader; |
17
|
|
|
|
|
|
|
XSLoader::load ('Gzip::Zopfli', $VERSION); |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
1359
|
use File::Slurper qw!read_binary write_binary!; |
|
2
|
|
|
|
|
28119
|
|
|
2
|
|
|
|
|
547
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_from |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
|
|
0
|
0
|
|
my (%options) = @_; |
24
|
0
|
|
|
|
|
|
my $from; |
25
|
0
|
0
|
|
|
|
|
if ($options{in}) { |
|
|
0
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$from = read_binary ($options{in}); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
elsif ($options{from}) { |
29
|
0
|
|
|
|
|
|
$from = $options{from}; |
30
|
|
|
|
|
|
|
} |
31
|
0
|
0
|
|
|
|
|
if (! $from) { |
32
|
0
|
|
|
|
|
|
carp "Specify one of from => scalar or in => file"; |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
|
return $from; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub make_out |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
0
|
0
|
|
my ($out, %options) = @_; |
40
|
0
|
|
|
|
|
|
my $outfile = $options{out}; |
41
|
0
|
0
|
|
|
|
|
if ($outfile) { |
42
|
0
|
|
|
|
|
|
write_binary ($outfile, $out); |
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
return $out; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub zopfli_compress_file |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
0
|
1
|
|
my ($o, %options) = @_; |
50
|
0
|
|
|
|
|
|
my $from = get_from (%options); |
51
|
0
|
0
|
|
|
|
|
if (! $from) { |
52
|
0
|
|
|
|
|
|
return undef; |
53
|
|
|
|
|
|
|
} |
54
|
0
|
|
|
|
|
|
my $out = ZopfliCompress ($from, no_warn => 1, %options); |
55
|
0
|
|
|
|
|
|
return make_out ($out, %options); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |