File Coverage

blib/lib/IO/File/WithFilename.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 2 50.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package IO::File::WithFilename;
2              
3 1     1   53412 use 5.010001;
  1         3  
  1         312  
4 1     1   8 use strict;
  1         2  
  1         33  
5 1     1   5 use warnings;
  1         5  
  1         39  
6              
7 1     1   881 use IO::File;
  1         920  
  1         140  
8              
9             require Exporter;
10              
11 1     1   5 use overload '""' => \&filename, fallback => 1;
  1         1  
  1         9  
12              
13             our $VERSION = '0.01';
14              
15             our @ISA = qw/IO::File Exporter/;
16              
17             our @EXPORT = @IO::File::EXPORT;
18              
19             sub open {
20 1     1 1 1244 my $self = shift;
21 1         2 ${*$self} = $_[0]; # store the filename in the scalar slot
  1         133  
22 1         10 $self->SUPER::open(@_);
23             }
24              
25             sub filename {
26 3     3 0 429 my $self = shift;
27 3         4 return ${*$self};
  3         16  
28             }
29              
30             1;
31             __END__