| 1 | package Gzip::Zopfli; | ||||||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 2 | ▶ | use Carp; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 2 | ▶ | use utf8; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 2 | require Exporter; | |||||||||||||
| 7 | 2 | our @ISA = qw(Exporter); | |||||||||||||
| 8 | 2 | our @EXPORT_OK = qw/ | |||||||||||||
| 9 | zopfli_compress | ||||||||||||||
| 10 | zopfli_compress_file | ||||||||||||||
| 11 | /; | ||||||||||||||
| 12 | 2 | our %EXPORT_TAGS = ( | |||||||||||||
| 13 | all => \@EXPORT_OK, | ||||||||||||||
| 14 | ); | ||||||||||||||
| 15 | 2 | our $VERSION = '0.02'; | |||||||||||||
| 16 | 2 | require XSLoader; | |||||||||||||
| 17 | 2 | XSLoader::load ('Gzip::Zopfli', $VERSION); | |||||||||||||
| 18 | |||||||||||||||
| 19 | 2 | ▶ | use File::Slurper qw!read_binary write_binary!; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 20 | |||||||||||||||
| 21 | sub get_from | ||||||||||||||
| 22 | 0 | ▶ | { | ||||||||||||
|
Subroutine
get_from: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||
| 23 | 0 | my (%options) = @_; | |||||||||||||
| 24 | 0 | my $from; | |||||||||||||
| 25 | 0 | ▶ | if ($options{in}) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 26 | 0 | $from = read_binary ($options{in}); | |||||||||||||
| 27 | } | ||||||||||||||
| 28 | elsif ($options{from}) { | ||||||||||||||
| 29 | 0 | $from = $options{from}; | |||||||||||||
| 30 | } | ||||||||||||||
| 31 | 0 | ▶ | if (! $from) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 32 | 0 | carp "Specify one of from => scalar or in => file"; | |||||||||||||
| 33 | } | ||||||||||||||
| 34 | 0 | return $from; | |||||||||||||
| 35 | } | ||||||||||||||
| 36 | |||||||||||||||
| 37 | sub make_out | ||||||||||||||
| 38 | 0 | ▶ | { | ||||||||||||
|
Subroutine
make_out: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 39 | 0 | my ($out, %options) = @_; | |||||||||||||
| 40 | 0 | my $outfile = $options{out}; | |||||||||||||
| 41 | 0 | ▶ | if ($outfile) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 42 | 0 | write_binary ($outfile, $out); | |||||||||||||
| 43 | } | ||||||||||||||
| 44 | 0 | return $out; | |||||||||||||
| 45 | } | ||||||||||||||
| 46 | |||||||||||||||
| 47 | sub zopfli_compress_file | ||||||||||||||
| 48 | 0 | ▶ | { | ||||||||||||
|
Subroutine
zopfli_compress_file: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||
| 49 | 0 | my ($o, %options) = @_; | |||||||||||||
| 50 | 0 | my $from = get_from (%options); | |||||||||||||
| 51 | 0 | ▶ | if (! $from) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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 | 2 | 1; | |||||||||||||