File Coverage

lib/Path/Extended/Class/File.pm
Criterion Covered Total %
statement 23 29 79.3
branch 1 2 50.0
condition 1 3 33.3
subroutine 8 11 72.7
pod 7 7 100.0
total 40 52 76.9


line stmt bran cond sub pod time code
1             package Path::Extended::Class::File;
2              
3 3     3   29 use strict;
  3         4  
  3         115  
4 3     3   13 use warnings;
  3         4  
  3         91  
5 3     3   11 use base qw( Path::Extended::File );
  3         6  
  3         1266  
6              
7             sub _initialize {
8 39     39   66 my ($self, @args) = @_;
9              
10 39         238 my $file = File::Spec->catfile( @args );
11 39         109 $self->_set_path($file);
12 39         59 $self->{is_dir} = 0;
13 39         55 $self->{_compat} = 1;
14              
15 39         109 $self;
16             }
17              
18             sub new_foreign {
19 0     0 1 0 my ($class, $type, @args) = @_;
20 0         0 $class->new(@args);
21             }
22              
23             sub absolute {
24 0     0 1 0 my $self = shift;
25 0         0 $self->{_base} = undef;
26 0         0 $self;
27             }
28              
29             sub relative {
30 5     5 1 13 my $self = shift;
31 5 50       16 my $base = @_ % 2 ? shift : undef;
32 5         11 my %options = @_;
33 5   33     17 $self->{_base} = $base || $options{base} || File::Spec->curdir;
34 5         15 $self;
35             }
36              
37 6     6 1 1046 sub dir { shift->parent }
38 0     0 1 0 sub volume { shift->parent->volume }
39 1     1 1 3 sub cleanup { shift } # is always clean
40 12     12 1 45 sub as_foreign { shift } # does nothing
41              
42             1;
43              
44             __END__