File Coverage

blib/lib/Sys/Export/VFAT/File.pm
Criterion Covered Total %
statement 35 35 100.0
branch 3 4 75.0
condition n/a
subroutine 17 17 100.0
pod 12 12 100.0
total 67 68 98.5


line stmt bran cond sub pod time code
1             package Sys::Export::VFAT::File;
2              
3             our $VERSION = '0.006'; # VERSION
4             # ABSTRACT: Represents a file in VFAT, including packed encodings of directories
5              
6 3     3   30 use v5.26;
  3         9  
7 3     3   10 use warnings;
  3         5  
  3         120  
8 3     3   12 use experimental qw( signatures );
  3         4  
  3         16  
9 3     3   361 use Sys::Export::VFAT;
  3         22  
  3         102  
10 3     3   10 use Carp;
  3         4  
  3         1546  
11             our @CARP_NOT= qw( Sys::Export::VFAT );
12              
13              
14 10581     10581 1 12282 sub new($class, %attrs) {
  10581         11026  
  10581         36647  
  10581         9882  
15 10581         16838 my $self= bless {}, $class;
16 10581         15406 for (qw( name size data flags btime atime mtime align device_offset cluster )) {
17 105810 100       143688 if (defined (my $v= delete $attrs{$_})) {
18 42234         57785 $self->{$_}= $v
19             }
20             }
21 10581 50       15657 croak "Unknown attribute: ".join(', ', keys %attrs) if keys %attrs;
22 10581         17036 $self;
23             }
24              
25              
26 45280     45280 1 73591 sub name { $_[0]{name} }
27 50836     50836 1 82061 sub size { $_[0]{size} }
28 10611     10611 1 19380 sub data { $_[0]{data} }
29 10550     10550 1 23819 sub flags { $_[0]{flags} }
30 10618     10618 1 26677 sub mtime { $_[0]{mtime} }
31 10618     10618 1 23781 sub atime { $_[0]{atime} }
32 10618     10618 1 26411 sub btime { $_[0]{btime} }
33 31039     31039 1 43186 sub align { $_[0]{align} }
34 30687     30687 1 51145 sub device_offset { $_[0]{device_offset} }
35 21233     21233 1 49585 sub cluster { $_[0]{cluster} }
36 21135     21135 1 40720 sub is_dir { $_[0]{flags} & Sys::Export::VFAT::ATTR_DIRECTORY() }
37              
38             # Avoiding dependency on namespace::clean
39             delete @{Sys::Export::VFAT::File::}{qw( carp confess croak )};
40             1;
41              
42             __END__