line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
114
|
|
|
114
|
|
2171
|
use 5.006; |
|
114
|
|
|
|
|
417
|
|
2
|
114
|
|
|
114
|
|
593
|
use strict; |
|
114
|
|
|
|
|
230
|
|
|
114
|
|
|
|
|
2748
|
|
3
|
114
|
|
|
114
|
|
546
|
use warnings; |
|
114
|
|
|
|
|
238
|
|
|
114
|
|
|
|
|
43422
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package LINQ::Util::Internal; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub create_linq { |
11
|
93
|
|
|
93
|
1
|
663
|
require LINQ; |
12
|
93
|
|
|
|
|
341
|
goto \&LINQ::LINQ; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub throw { |
16
|
49
|
|
|
49
|
1
|
17672
|
require LINQ::Exception; |
17
|
49
|
|
|
|
|
156
|
my $e = shift; |
18
|
49
|
|
|
|
|
413
|
"LINQ::Exception::$e"->throw( @_ ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub assert_code { |
22
|
956
|
|
|
956
|
1
|
1378
|
my $code = shift; |
23
|
|
|
|
|
|
|
|
24
|
956
|
100
|
|
|
|
2243
|
if ( ref( $code ) eq 'ARRAY' ) { |
25
|
4
|
|
|
|
|
11
|
@_ = @$code; |
26
|
4
|
|
|
|
|
8
|
$code = shift; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
956
|
100
|
|
|
|
1899
|
if ( ref( $code ) eq 'Regexp' ) { |
30
|
11
|
50
|
|
|
|
51
|
throw( |
31
|
|
|
|
|
|
|
"CallerError", |
32
|
|
|
|
|
|
|
message => "Regexp cannot accept curried arguments" |
33
|
|
|
|
|
|
|
) if @_; |
34
|
|
|
|
|
|
|
|
35
|
11
|
|
|
|
|
21
|
my $re = $code; |
36
|
11
|
|
|
35
|
|
60
|
return sub { m/$re/ }; |
|
35
|
|
|
|
|
232
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
945
|
100
|
|
|
|
2123
|
if ( ref( $code ) ne 'CODE' ) { |
40
|
31
|
|
|
|
|
128
|
require Scalar::Util; |
41
|
31
|
|
|
|
|
92
|
require overload; |
42
|
|
|
|
|
|
|
|
43
|
31
|
50
|
33
|
|
|
171
|
throw( |
44
|
|
|
|
|
|
|
"CallerError", |
45
|
|
|
|
|
|
|
message => "Expected coderef; got '$code'" |
46
|
|
|
|
|
|
|
) unless Scalar::Util::blessed( $code ) && overload::Method( $code, '&{}' ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
945
|
100
|
|
|
|
3403
|
if ( @_ ) { |
50
|
40
|
|
|
|
|
89
|
my @curry = @_; |
51
|
40
|
|
|
127
|
|
216
|
return sub { $code->( @curry, @_ ) }; |
|
127
|
|
|
|
|
303
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
905
|
|
|
|
|
2750
|
return $code; |
55
|
|
|
|
|
|
|
} #/ sub assert_code |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=pod |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=encoding utf-8 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 NAME |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
LINQ::Util::Internal - common functions used internally by LINQ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 FUNCTIONS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item C<< create_linq( SOURCE ) >> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item C<< throw( EXCEPTION_TYPE, ARGS ) >> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item C<< assert_code( CALLABLE ) >> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 BUGS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Please report any bugs to |
84
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=LINQ>. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SEE ALSO |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L<LINQ>. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 AUTHOR |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Toby Inkster. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
99
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
104
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
105
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |