blib/lib/Filter/gunzip.pm

filter: Statementstmt 84.6% 22 / 26 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 73.8% 31 / 42 CC 3 SCAR 9.2
CC
3
Cov
74%
import
4.5
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« blib/lib/Filter/gunzip/Filter.pm ↑ Summary gunzip.xs »
1 # Copyright 2010, 2011, 2013, 2014, 2019 Kevin Ryde
2  
3 # This file is part of Filter-gunzip.
4 #
5 # Filter-gunzip is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the Free
7 # Software Foundation; either version 3, or (at your option) any later
8 # version.
9 #
10 # Filter-gunzip is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with Filter-gunzip. If not, see <http://www.gnu.org/licenses/>.
17  
18 package Filter::gunzip;
19 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use DynaLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 2 ▶use vars qw($VERSION @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 $VERSION = 8;
25 2 @ISA = ('DynaLoader');
26  
27 # uncomment this to run the ### lines
28 # use Smart::Comments;
29  
30 2 my $use_xs = 1;
31 2 ▶if (! eval { __PACKAGE__->bootstrap($VERSION) }) {
Branch: 2 branches
BranchTrueFalseTotal
if (not eval { do { __PACKAGE__->bootstrap($Filter::gunzip::VERSION) } }) { } 0 2 2
elsif (not eval { do { require PerlIO::gzip; 1 } }) { } 0 2 2
32 ### filter gunzip no XS: $@
33 0 $use_xs = 0;
34 2 } elsif (! eval { require PerlIO::gzip; 1 }) {
35 ### filter gunzip have XS but no have PerlIO gzip: $@
36 0 $use_xs = 0;
37 }
38  
39 1 ▶sub import {
Subroutine import: called CC=3 SCAR=15.1
40 1 my ($class) = @_;
41 1 ▶ if ($use_xs && _filter_by_layer()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($use_xs and _filter_by_layer()) { } 1 0 1
Condition33%1/3
$use_xs and _filter_by_layer()
!ll&&!rl&&r
001
MC/DC0%0/2
$use_xs and _filter_by_layer()
$use_xs _filter_by_layer()
Truth table33%1/3
A and B
A= $use_xsB= _filter_by_layer()
ABresult
0X0
100
111
42 ### applied gzip layer ...
43 } else {
44 ### use Filter gunzip Filter ...
45 0 require Filter::gunzip::Filter;
46 0 Filter::gunzip::Filter->import;
47 }
48 }
49  
50 2 1;
51 __END__
« blib/lib/Filter/gunzip/Filter.pm ↑ Summary gunzip.xs »