File Coverage

inc/List/MoreUtils.pm
Criterion Covered Total %
statement 28 29 96.5
branch 2 6 33.3
condition 2 6 33.3
subroutine 9 9 100.0
pod n/a
total 41 50 82.0


line stmt bran cond sub pod time code
1             #line 1
2             package List::MoreUtils;
3 6     6   60473  
  6         26  
4 6     6   33 use 5.008_001;
  6         14  
  6         2036  
5 6     6   33 use strict;
  6         13  
  6         714  
6             use warnings;
7              
8             my $have_xs;
9             our $VERSION = '0.428';
10              
11 0         0 BEGIN
12 6 50   6   27 {
13             unless (defined($have_xs))
14 6 50       33 {
  6         3037  
15 6 0 33     5987 eval { require List::MoreUtils::XS; } unless $ENV{LIST_MOREUTILS_PP};
      33        
16 6         183 die $@ if $@ && defined $ENV{LIST_MOREUTILS_PP} && $ENV{LIST_MOREUTILS_PP} == 0;
17             $have_xs = 0+defined( $INC{'List/MoreUtils/XS.pm'});
18             }
19 6     6   2930  
  6         17  
  6         130  
20             use List::MoreUtils::PP qw();
21             }
22 6     6   2890  
  6         19  
  6         605  
23             use Exporter::Tiny qw();
24              
25             my @junctions = qw(any all none notall);
26             my @v0_22 = qw(
27             true false
28             firstidx lastidx
29             insert_after insert_after_string
30             apply indexes
31             after after_incl before before_incl
32             firstval lastval
33             each_array each_arrayref
34             pairwise natatime
35             mesh uniq
36             minmax part
37             _XScompiled
38             );
39             my @v0_24 = qw(bsearch);
40             my @v0_33 = qw(sort_by nsort_by);
41             my @v0_400 = qw(one any_u all_u none_u notall_u one_u
42             firstres onlyidx onlyval onlyres lastres
43             singleton bsearchidx
44             );
45             my @v0_420 = qw(arrayify duplicates minmaxstr samples zip6 reduce_0 reduce_1 reduce_u
46             listcmp frequency occurrences mode
47             binsert bremove equal_range lower_bound upper_bound qsort);
48              
49             my @all_functions = (@junctions, @v0_22, @v0_24, @v0_33, @v0_400, @v0_420);
50 6     6   42  
  6         47  
  6         530  
51             no strict "refs";
52             if ($have_xs)
53             {
54             my $x;
55             for (@all_functions)
56             {
57             List::MoreUtils->can($_) or *$_ = $x if ($x = List::MoreUtils::XS->can($_));
58             }
59             }
60 6     6   37 List::MoreUtils->can($_) or *$_ = List::MoreUtils::PP->can($_) for (@all_functions);
  6         25  
  6         1453  
61             use strict;
62              
63             my %alias_list = (
64             v0_22 => {
65             first_index => "firstidx",
66             last_index => "lastidx",
67             first_value => "firstval",
68             last_value => "lastval",
69             zip => "mesh",
70             },
71             v0_33 => {
72             distinct => "uniq",
73             },
74             v0_400 => {
75             first_result => "firstres",
76             only_index => "onlyidx",
77             only_value => "onlyval",
78             only_result => "onlyres",
79             last_result => "lastres",
80             bsearch_index => "bsearchidx",
81             },
82             v0_420 => {
83             bsearch_insert => "binsert",
84             bsearch_remove => "bremove",
85             zip_unflatten => "zip6",
86             },
87             );
88              
89             our @ISA = qw(Exporter::Tiny);
90             our @EXPORT_OK = (@all_functions, map { keys %$_ } values %alias_list);
91             our %EXPORT_TAGS = (
92             all => \@EXPORT_OK,
93             'like_0.22' => [
94             any_u => {-as => 'any'},
95             all_u => {-as => 'all'},
96             none_u => {-as => 'none'},
97             notall_u => {-as => 'notall'},
98             @v0_22,
99             keys %{$alias_list{v0_22}},
100             ],
101             'like_0.24' => [
102             any_u => {-as => 'any'},
103             all_u => {-as => 'all'},
104             notall_u => {-as => 'notall'},
105             'none',
106             @v0_22,
107             @v0_24,
108             keys %{$alias_list{v0_22}},
109             ],
110             'like_0.33' => [
111             @junctions,
112             @v0_22,
113             # v0_24 functions were omitted
114             @v0_33,
115             keys %{$alias_list{v0_22}},
116             keys %{$alias_list{v0_33}},
117             ],
118             );
119              
120             for my $set (values %alias_list)
121             {
122             for my $alias (keys %$set)
123 6     6   49 {
  6         25  
  6         577  
124             no strict qw(refs);
125             *$alias = __PACKAGE__->can($set->{$alias});
126             }
127             }
128              
129             #line 1241
130              
131             1;