blib/lib/Filter/Util/Call.pm

filter: Statementstmt 100% 33 / 33 Branchbran 100% 8 / 8 Conditioncond 91.6% 11 / 12 MC/DCmcdc 85.7% 6 / 7 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 97.0% 65 / 67 CC 9 SCAR 14.4
CC
9
Cov
98%
filter_read_exact
6.0
filter_add
4.0
BEGIN
1.0
CRAP 4.2
« blib/lib/Filter/m4.pm ↑ 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, 2018-2022 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 20 require 5.006 ; # our
13 20 require Exporter;
14  
15 20 ▶use XSLoader ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 20 our @ISA = qw(Exporter);
20 20 our @EXPORT = qw( filter_add filter_del filter_read filter_read_exact) ;
21 20 our $VERSION = "1.64" ;
22 20 our $XS_VERSION = $VERSION;
23 20 $VERSION = eval $VERSION;
24  
25 sub filter_read_exact($)
26 {
27 9 ▶ my ($size) = @_ ;
Subroutine filter_read_exact: called CC=6 SCAR=17.9
Pod documented
28 9 my ($left) = $size ;
29 9 my ($status) ;
30  
31 9 ▶ unless ( $size > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($size > 0) 1 8 9
32 1 require Carp;
33 1 Carp::croak("filter_read_exact: size parameter must be > 0");
34 }
35  
36 # try to read a block which is exactly $size bytes long
37 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
38 7 $left = $size - length $_ ;
39 }
40  
41 # EOF with pending data is a special case
42 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
43  
44 7 return $status ;
45 }
46  
47 sub filter_add($)
48 {
49 22 ▶ my($obj) = @_ ;
Subroutine filter_add: called CC=4 SCAR=13.9
Pod documented
50  
51 # Did we get a code reference?
52 22 my $coderef = (ref $obj eq 'CODE');
53  
54 # If the parameter isn't already a reference, make it one.
55 22 ▶ 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 20 22
Condition83%5/6
not $coderef and !ref($obj) || ref($obj) =~ /^ARRAY|HASH$/
!ll&&!rl&&r
5152
not ref $obj or ref($obj) =~ /^ARRAY|HASH$/
l!l&&r!l&&!r
0215
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
56 2 $obj = bless (\$obj, (caller)[0]);
57 }
58  
59 # finish off the installation of the filter in C.
60 22 Filter::Util::Call::real_import($obj, (caller)[0], $coderef) ;
61 }
62  
63 20 XSLoader::load('Filter::Util::Call');
64  
65 20 1;
66 __END__
« blib/lib/Filter/m4.pm ↑ Summary blib/lib/Filter/sh.pm »