line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
58
|
|
|
58
|
|
2490
|
use 5.006; |
|
58
|
|
|
|
|
189
|
|
2
|
58
|
|
|
58
|
|
291
|
use strict; |
|
58
|
|
|
|
|
90
|
|
|
58
|
|
|
|
|
1145
|
|
3
|
58
|
|
|
58
|
|
239
|
use warnings; |
|
58
|
|
|
|
|
102
|
|
|
58
|
|
|
|
|
4089
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
if ( $] < 5.010000 ) { |
6
|
|
|
|
|
|
|
require UNIVERSAL::DOES; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package LINQ::Array; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
12
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
13
|
|
|
|
|
|
|
|
14
|
58
|
|
|
58
|
|
24298
|
use Role::Tiny::With (); |
|
58
|
|
|
|
|
269377
|
|
|
58
|
|
|
|
|
6897
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Role::Tiny::With::with( qw( LINQ::Collection ) ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
265
|
|
|
265
|
1
|
427
|
my $class = shift; |
20
|
265
|
|
|
|
|
336
|
bless [ @{ $_[0] } ], $class; |
|
265
|
|
|
|
|
1746
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub count { |
24
|
20
|
|
|
20
|
1
|
201
|
my $self = shift; |
25
|
20
|
100
|
|
|
|
52
|
return $self->where( @_ )->count if @_; |
26
|
19
|
|
|
|
|
93
|
scalar @$self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub to_list { |
30
|
325
|
|
|
325
|
1
|
472
|
my $self = shift; |
31
|
325
|
|
|
|
|
1476
|
@$self; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=pod |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=encoding utf-8 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
LINQ::Array - a LINQ collection with an arrayref backend |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SYNOPSIS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use LINQ qw( LINQ ); |
49
|
|
|
|
|
|
|
use LINQ::Array; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $linq = LINQ( [ 1 .. 3 ] ); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Same: |
54
|
|
|
|
|
|
|
my $linq = 'LINQ::Array'->new( [ 1 .. 3 ] ); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
LINQ::Array supports all the methods defined in L<LINQ::Collection>. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=begin trustme |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item new |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item count |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item to_list |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=end trustme |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 BUGS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Please report any bugs to |
73
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=LINQ>. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SEE ALSO |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
L<LINQ>, L<LINQ::Collection>. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L<https://en.wikipedia.org/wiki/Language_Integrated_Query> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHOR |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Toby Inkster. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
90
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
95
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
96
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |