LINQ/Util/Internal.pm

filter: Statementstmt 100% 34 / 34 Branchbran 83.3% 10 / 12 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 90.3% 56 / 62 CC 8 SCAR 15.7
CC
8
Cov
92%
assert_code
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
« LINQ/FieldSet.pm ↑ Summary LINQ/Iterator.pm »
1 116 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 116 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 116 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package LINQ::Util::Internal;
6  
7 116 our $AUTHORITY = 'cpan:TOBYINK';
8 116 our $VERSION = '0.003';
9  
10 103 ▶sub create_linq {
Subroutine create_linq: called CC=1 SCAR=0.0
Pod documented
11 103 require LINQ;
12 103 goto \&LINQ::LINQ;
13 }
14  
15 49 ▶sub throw {
Subroutine throw: called CC=1 SCAR=0.0
Pod documented
16 49 require LINQ::Exception;
17 49 my $e = shift;
18 49 "LINQ::Exception::$e"->throw( @_ );
19 }
20  
21 1002 ▶sub assert_code {
Subroutine assert_code: called CC=8 SCAR=20.9
Pod documented
22 1002 my $code = shift;
23
24 1002 ▶ if ( ref( $code ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $code eq "ARRAY") 4 998 1002
25 4 @_ = @$code;
26 4 $code = shift;
27 }
28
29 1002 ▶ if ( ref( $code ) eq 'Regexp' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $code eq "Regexp") 11 991 1002
30 11 ▶ throw(
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 11 11
31 "CallerError",
32 message => "Regexp cannot accept curried arguments"
33 ) if @_;
34
35 11 my $re = $code;
36 11 ▶ return sub { m/$re/ };
Subroutine __ANON__: called CC=1 SCAR=0.0
37 }
38
39 991 ▶ if ( ref( $code ) ne 'CODE' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $code ne "CODE") 39 952 991
40 39 require Scalar::Util;
41 39 require overload;
42
43 39 ▶ throw(
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($code) and overload::Method($code, "&{}") 0 39 39
Condition33%1/3
builtin::blessed($code) and overload::Method($code, "&{}")
!ll&&!rl&&r
0039
MC/DC0%0/2
builtin::blessed($code) and overload::Method($code, "&{}")
builtin::blessed($code) overload::Method($code, "&{}")
Truth table33%1/3
A and B
A= builtin::blessed($code)B= overload::Method($code, "&{}")
ABresult
0X0
100
111
44 "CallerError",
45 message => "Expected coderef; got '$code'"
46 ) unless Scalar::Util::blessed( $code ) && overload::Method( $code, '&{}' );
47 }
48
49 991 ▶ if ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 40 951 991
50 40 my @curry = @_;
51 40 ▶ return sub { $code->( @curry, @_ ) };
Subroutine __ANON__: called CC=1 SCAR=0.0
52 }
53
54 951 return $code;
55 } #/ sub assert_code
56  
57 116 1;
58  
59 __END__
« LINQ/FieldSet.pm ↑ Summary LINQ/Iterator.pm »