| 1 | package lib::absolute; | ||||||||||
| 2 | 3 | our $AUTHORITY = 'cpan:GETTY'; | |||||||||
| 3 | # ABSTRACT: Convert all paths in @INC to absolute paths | ||||||||||
| 4 | 3 | $lib::absolute::VERSION = '0.100'; | |||||||||
| 5 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 3 | ▶ | use Path::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 3 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=5 SCAR=16.3
| |||||||||||
| 10 | 3 | my ( $self, @args ) = @_; | |||||||||
| 11 | 3 | my $hard = grep { $_ eq '-hard' } @args; | |||||||||
| 12 | @INC = map { | ||||||||||
| 13 | 3 | ▶ | if (ref $_) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 0 | $_; | |||||||||
| 15 | } else { | ||||||||||
| 16 | 19 | my $dir = path($_)->absolute; | |||||||||
| 17 | 19 | ▶ | if ($hard) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 1 | ▶ | die $dir.' of @INC doesn\'t exist' unless -d $dir; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | } | ||||||||||
| 20 | 18 | ▶ | $dir->stringify, $_ eq '.' ? '.' : (); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | } | ||||||||||
| 22 | } @INC; | ||||||||||
| 23 | 2 | return; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 3 | 1; | |||||||||
| 27 | |||||||||||
| 28 | __END__ | ||||||||||