blib/lib/Filter/Util/Call.pm

filter: Statementstmt 100% 35 / 35 Branchbran 87.5% 7 / 8 Conditioncond 91.6% 11 / 12 MC/DCmcdc 85.7% 6 / 7 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 95.7% 67 / 70 CC 9 SCAR 13.9
CC
9
Cov
96%
filter_read_exact
6.0
filter_add
4.0
BEGIN
1.0
CRAP 4.0
↑ Summary blib/lib/Filter/sh.pm »
1 # Call.pm
2 #
3 # Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
4 # Copyright (c) 2011-2014 Reini Urban. All rights reserved.
5 # Copyright (c) 2014-2017 cPanel Inc. All rights reserved.
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the same terms as Perl itself.
9
10 package Filter::Util::Call ;
11  
12 19 require 5.005 ;
13 19 require DynaLoader;
14 19 require Exporter;
15 19 ▶use Carp ;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 19 ▶use vars qw($VERSION $XS_VERSION @ISA @EXPORT) ;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 19 @ISA = qw(Exporter DynaLoader);
21 19 @EXPORT = qw( filter_add filter_del filter_read filter_read_exact) ;
22 19 $VERSION = "1.56_02" ;
23 19 $XS_VERSION = $VERSION;
24 19 $VERSION = eval $VERSION;
25  
26 sub filter_read_exact($)
27 {
28 8 ▶ my ($size) = @_ ;
Subroutine filter_read_exact: called CC=6 SCAR=17.9
Pod documented
29 8 my ($left) = $size ;
30 8 my ($status) ;
31  
32 8 ▶ croak ("filter_read_exact: size parameter must be > 0")
Branch: 1 branch
BranchTrueFalseTotal
unless $size > 0 0 8 8
33 unless $size > 0 ;
34  
35 # try to read a block which is exactly $size bytes long
36 8 ▶ while ($left and ($status = filter_read($left)) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left and ($status = &filter_read($left)) > 0) 7 8 15
Condition100%3/3
$left and ($status = &filter_read($left)) > 0
!ll&&!rl&&r
627
MC/DC100%2/2
$left and ($status = &filter_read($left)) > 0
$left ($status = &filter_read($left)) > 0
Truth table100%3/3
A and B
A= $leftB= ($status = &filter_read($left)) > 0
ABresult
0X0
100
111
37 7 $left = $size - length $_ ;
38 }
39  
40 # EOF with pending data is a special case
41 8 ▶ return 1 if $status == 0 and length $_ ;
Branch: 1 branch
BranchTrueFalseTotal
if $status == 0 and length $_ 1 7 8
Condition100%3/3
$status == 0 and length $_
!ll&&!rl&&r
611
MC/DC100%2/2
$status == 0 and length $_
$status == 0 length $_
Truth table100%3/3
A and B
A= $status == 0B= length $_
ABresult
0X0
100
111
42  
43 7 return $status ;
44 }
45  
46 sub filter_add($)
47 {
48 21 ▶ my($obj) = @_ ;
Subroutine filter_add: called CC=4 SCAR=13.9
Pod documented
49  
50 # Did we get a code reference?
51 21 my $coderef = (ref $obj eq 'CODE');
52  
53 # If the parameter isn't already a reference, make it one.
54 21 ▶ if (!$coderef and (!ref($obj) or ref($obj) =~ /^ARRAY|HASH$/)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $coderef and !ref($obj) || ref($obj) =~ /^ARRAY|HASH$/) 2 19 21
Condition83%5/6
not $coderef and !ref($obj) || ref($obj) =~ /^ARRAY|HASH$/
!ll&&!rl&&r
5142
not ref $obj or ref($obj) =~ /^ARRAY|HASH$/
l!l&&r!l&&!r
0214
MC/DC66%2/3
not $coderef and !ref($obj) || ref($obj) =~ /^ARRAY|HASH$/
not $coderef not ref $obj ref($obj) =~ /^ARRAY|HASH$/
Truth table75%3/4
not(A) and not(B) or C
A= not $coderefB= not ref $objC= ref($obj) =~ /^ARRAY|HASH$/
ABCresult
0XX0
1000
11X1
1011
55 2 $obj = bless (\$obj, (caller)[0]);
56 }
57  
58 # finish off the installation of the filter in C.
59 21 Filter::Util::Call::real_import($obj, (caller)[0], $coderef) ;
60 }
61  
62 19 bootstrap Filter::Util::Call ;
63  
64 19 1;
65 __END__
↑ Summary blib/lib/Filter/sh.pm »