| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition100%3/3
$left and ($status = &filter_read($left)) > 0
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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition100%3/3
$status == 0 and length $_
MC/DC100%2/2
$status == 0 and length $_
$status == 0
length $_
Truth table100%3/3
A and B
A= $status == 0B= length $_
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition83%5/6
not $coderef and !ref($obj) || ref($obj) =~ /^ARRAY|HASH$/
not ref $obj or ref($obj) =~ /^ARRAY|HASH$/
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$/
| |||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||