File Coverage

blib/lib/lib/absolute.pm
Criterion Covered Total %
statement 19 20 95.0
branch 6 8 75.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 29 32 90.6


line stmt bran cond sub pod time code
1             package lib::absolute;
2             our $AUTHORITY = 'cpan:GETTY';
3             # ABSTRACT: Convert all paths in @INC to absolute paths
4             $lib::absolute::VERSION = '0.100';
5 3     3   1511474 use strict;
  3         8  
  3         138  
6 3     3   17 use warnings;
  3         5  
  3         265  
7 3     3   1019 use Path::Tiny;
  3         19495  
  3         786  
8              
9             sub import {
10 3     3   39 my ( $self, @args ) = @_;
11 3         8 my $hard = grep { $_ eq '-hard' } @args;
  1         3  
12             @INC = map {
13 3 50       10 if (ref $_) {
  19         130  
14 0         0 $_;
15             } else {
16 19         46 my $dir = path($_)->absolute;
17 19 100       1939 if ($hard) {
18 1 50       5 die $dir.' of @INC doesn\'t exist' unless -d $dir;
19             }
20 18 100       54 $dir->stringify, $_ eq '.' ? '.' : ();
21             }
22             } @INC;
23 2         93 return;
24             }
25              
26             1;
27              
28             __END__