File Coverage

blib/lib/LINQ/Array.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 31 31 100.0


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