File Coverage

blib/lib/List/Util/MaybeXS.pm
Criterion Covered Total %
statement 24 27 88.8
branch 3 6 50.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 33 39 84.6


line stmt bran cond sub pod time code
1             package List::Util::MaybeXS;
2 1     1   56009 use strict;
  1         13  
  1         26  
3 1     1   4 use warnings;
  1         1  
  1         24  
4 1     1   3 use Exporter (); BEGIN { *import = \&Exporter::import }
  1     1   2  
  1         22  
  1         102  
5              
6             our $VERSION = '1.500010';
7             $VERSION =~ tr/_//d;
8              
9             our @EXPORT_OK;
10             BEGIN {
11 1     1   232 @EXPORT_OK = qw(
12             all any first none notall
13             min max minstr maxstr
14             product reductions reduce sum sum0
15             sample shuffle
16             uniq uniqnum uniqint uniqstr
17             pairs unpairs pairkeys pairvalues pairmap pairgrep pairfirst
18             head tail
19             zip zip_longest zip_shortest
20             mesh mesh_longest mesh_shortest
21             );
22             }
23              
24             my $rand = do { our $RAND };
25             *RAND = *List::Util::RAND;
26             *List::Util::PP::RAND = *List::Util::RAND;
27             our $RAND;
28             $RAND = $rand
29             if !defined $RAND;
30              
31             BEGIN {
32 1     1   3 my %need;
33 1         38 @need{@EXPORT_OK} = ();
34 1         2 local $@;
35 1 50       1 if (eval { require List::Util; 1 }) {
  1         5  
  1         4  
36 1         5 my @import = grep defined &{"List::Util::$_"}, keys %need;
  35         76  
37 1 50       4 if ( ! eval { List::Util->VERSION(1.45) } ) {
  1         27  
38 0         0 @import = grep !/^uniq/, @import;
39             }
40 1         152 List::Util->import(@import);
41 1         6 delete @need{@import};
42             }
43 1 50       34 if (keys %need) {
44 0           require List::Util::PP;
45 0           List::Util::PP->import(keys %need);
46             }
47             }
48              
49             1;
50             __END__