LINQ/Array.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 94.8% 37 / 39 SCAR 6.9
CC
2
Cov
93%
count
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« LINQ/FieldSet/Single.pm ↑ Summary LINQ/Grouping.pm »
1 58 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 58 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 58 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 58 ▶if ( $] < 5.010000 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.01") 0 58 58
6 0 require UNIVERSAL::DOES;
7 }
8  
9 package LINQ::Array;
10  
11 58 our $AUTHORITY = 'cpan:TOBYINK';
12 58 our $VERSION = '0.002';
13  
14 58 ▶use Role::Tiny::With ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 58 Role::Tiny::With::with( qw( LINQ::Collection ) );
17  
18 sub new {
19 265 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
20 265 bless [ @{ $_[0] } ], $class;
21 }
22  
23 sub count {
24 20 ▶ my $self = shift;
Subroutine count: called CC=2 SCAR=6.9
Pod documented
25 20 ▶ return $self->where( @_ )->count if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 1 19 20
26 19 scalar @$self;
27 }
28  
29 sub to_list {
30 325 ▶ my $self = shift;
Subroutine to_list: called CC=1 SCAR=0.0
Pod documented
31 325 @$self;
32 }
33  
34 58 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.
« LINQ/FieldSet/Single.pm ↑ Summary LINQ/Grouping.pm »