| 1 | 4 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package lib::byversion; | ||||||||||
| 6 | |||||||||||
| 7 | 4 | our $VERSION = '0.002002'; | |||||||||
| 8 | |||||||||||
| 9 | # ABSTRACT: add paths to @INC depending on which version of Perl is running. | ||||||||||
| 10 | |||||||||||
| 11 | 4 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||
| 12 | |||||||||||
| 13 | 4 | ▶ | use lib (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 4 | ▶ | use version 0.77; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 4 | ▶ | use String::Formatter stringf => { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | -as => path_format =>, | ||||||||||
| 18 | codes => { | ||||||||||
| 19 | v => "$]", | ||||||||||
| 20 | 4 | V => do { | |||||||||
| 21 | 4 | my $x = version->parse("$]")->normal; | |||||||||
| 22 | 4 | $x =~ s{^v}{}sx; | |||||||||
| 23 | 4 | $x; | |||||||||
| 24 | }, | ||||||||||
| 25 | }, | ||||||||||
| 26 | 4 | }; | |||||||||
| 27 | |||||||||||
| 28 | 2 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=2 SCAR=7.4
| |||||||||||
| 29 | 2 | my ( undef, @args ) = @_; | |||||||||
| 30 | 2 | ▶ | if ( @args != 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | die 'lib::byversion->import takes exactly one argument, instead, you specified ' . scalar @args; | |||||||||
| 32 | } | ||||||||||
| 33 | 2 | my $path = path_format(@args); | |||||||||
| 34 | 2 | return lib->import($path); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | ## no critic (ProhibitBuiltinHomonyms) | ||||||||||
| 38 | 1 | ▶ | sub unimport { | ||||||||
|
Subroutine
unimport: called CC=2 SCAR=7.4
| |||||||||||
| 39 | 1 | my ( undef, @args ) = @_; | |||||||||
| 40 | 1 | ▶ | if ( @args != 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 0 | die 'lib::byversion->unimport takes exactly one argument, instead, you specified ' . scalar @args; | |||||||||
| 42 | } | ||||||||||
| 43 | 1 | my $path = path_format(@args); | |||||||||
| 44 | 1 | return lib->unimport($path); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 4 | 1; | |||||||||
| 48 | |||||||||||
| 49 | __END__ | ||||||||||