| 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
| |||||||||||||||||||||||||||||
| 25 | 4 | @_ = @$code; | |||||||||||||||||||||||||||
| 26 | 4 | $code = shift; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1002 | ▶ | if ( ref( $code ) eq 'Regexp' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 11 | ▶ | throw( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 40 | 39 | require Scalar::Util; | |||||||||||||||||||||||||||
| 41 | 39 | require overload; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 39 | ▶ | throw( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($code) and overload::Method($code, "&{}")
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, "&{}")
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||