blib/lib/Gzip/Zopfli.pm

filter: Statementstmt 54.7% 23 / 42 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 33.3% 1 / 3 totaltotal 46.0% 29 / 63 CC 6 SCAR 21.3
CC
6
Cov
44%
get_from
20.0
make_out
6.0
zopfli_compress_file
6.0
CRAP 8.4
↑ Summary blib/lib/Gzip/make-c-file.pl »
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
BranchTrueFalseTotal
if ($options{'in'}) { } 0 0 0
elsif ($options{'from'}) { } 0 0 0
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
BranchTrueFalseTotal
unless ($from) 0 0 0
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
BranchTrueFalseTotal
if ($outfile) 0 0 0
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
BranchTrueFalseTotal
unless ($from) 0 0 0
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;
↑ Summary blib/lib/Gzip/make-c-file.pl »