| 1 | package List::SomeUtils; | ||
| 2 | |||
| 3 | 4 | ▶ | use 5.006; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 4 | our $VERSION = '0.59'; | |
| 8 | |||
| 9 | 4 | ▶ | use Exporter qw( import ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 4 | ▶ | use Module::Implementation 0.04; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 4 | my @subs = qw( | |
| 14 | after | ||
| 15 | after_incl | ||
| 16 | all | ||
| 17 | all_u | ||
| 18 | any | ||
| 19 | any_u | ||
| 20 | apply | ||
| 21 | before | ||
| 22 | before_incl | ||
| 23 | bsearch | ||
| 24 | bsearchidx | ||
| 25 | each_array | ||
| 26 | each_arrayref | ||
| 27 | false | ||
| 28 | firstidx | ||
| 29 | firstres | ||
| 30 | firstval | ||
| 31 | indexes | ||
| 32 | insert_after | ||
| 33 | insert_after_string | ||
| 34 | lastidx | ||
| 35 | lastres | ||
| 36 | lastval | ||
| 37 | mesh | ||
| 38 | minmax | ||
| 39 | mode | ||
| 40 | natatime | ||
| 41 | none | ||
| 42 | none_u | ||
| 43 | notall | ||
| 44 | notall_u | ||
| 45 | nsort_by | ||
| 46 | one | ||
| 47 | one_u | ||
| 48 | onlyidx | ||
| 49 | onlyres | ||
| 50 | onlyval | ||
| 51 | pairwise | ||
| 52 | part | ||
| 53 | singleton | ||
| 54 | sort_by | ||
| 55 | true | ||
| 56 | uniq | ||
| 57 | ); | ||
| 58 | |||
| 59 | 4 | my %aliases = ( | |
| 60 | bsearch_index => 'bsearchidx', | ||
| 61 | distinct => 'uniq', | ||
| 62 | first_index => 'firstidx', | ||
| 63 | first_result => 'firstres', | ||
| 64 | first_value => 'firstval', | ||
| 65 | last_index => 'lastidx', | ||
| 66 | last_result => 'lastres', | ||
| 67 | last_value => 'lastval', | ||
| 68 | only_index => 'onlyidx', | ||
| 69 | only_result => 'onlyres', | ||
| 70 | only_value => 'onlyval', | ||
| 71 | zip => 'mesh', | ||
| 72 | ); | ||
| 73 | |||
| 74 | 4 | our @EXPORT_OK = ( @subs, keys %aliases ); | |
| 75 | 4 | our %EXPORT_TAGS = ( all => \@EXPORT_OK ); | |
| 76 | |||
| 77 | { | ||
| 78 | 4 | my $loader = Module::Implementation::build_loader_sub( | |
| 79 | implementations => [ 'XS', 'PP' ], | ||
| 80 | symbols => \@subs, | ||
| 81 | ); | ||
| 82 | |||
| 83 | 4 | $loader->(); | |
| 84 | } | ||
| 85 | |||
| 86 | 4 | for my $alias ( keys %aliases ) { | |
| 87 | ## no critic (TestingAndDebugging::ProhibitNoStrict) | ||
| 88 | 4 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 89 | 48 | *{$alias} = __PACKAGE__->can( $aliases{$alias} ); | |
| 90 | } | ||
| 91 | |||
| 92 | ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) | ||
| 93 | 4 | ▶ | sub _XScompiled { |
|
Subroutine
_XScompiled: called CC=1 SCAR=0.0
| |||
| 94 | 4 | return Module::Implementation::implementation_for(__PACKAGE__) eq 'XS'; | |
| 95 | } | ||
| 96 | |||
| 97 | 4 | 1; | |
| 98 | |||
| 99 | # ABSTRACT: Provide the stuff missing in List::Util | ||
| 100 | |||
| 101 | __END__ | ||