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.005'; # VERSION
4             # ABSTRACT: Represents a file in VFAT, including packed encodings of directories
5              
6 3     3   32 use v5.26;
  3         9  
7 3     3   12 use warnings;
  3         4  
  3         124  
8 3     3   12 use experimental qw( signatures );
  3         3  
  3         14  
9 3     3   302 use Sys::Export::VFAT;
  3         5  
  3         123  
10 3     3   10 use Carp;
  3         4  
  3         1464  
11             our @CARP_NOT= qw( Sys::Export::VFAT );
12              
13              
14 10581     10581 1 11870 sub new($class, %attrs) {
  10581         11035  
  10581         39091  
  10581         9621  
15 10581         20357 my $self= bless {}, $class;
16 10581         17606 for (qw( name size data flags btime atime mtime align device_offset cluster )) {
17 105810 100       152015 if (defined (my $v= delete $attrs{$_})) {
18 42234         63601 $self->{$_}= $v
19             }
20             }
21 10581 50       17283 croak "Unknown attribute: ".join(', ', keys %attrs) if keys %attrs;
22 10581         19235 $self;
23             }
24              
25              
26 46052     46052 1 88238 sub name { $_[0]{name} }
27 50836     50836 1 98063 sub size { $_[0]{size} }
28 10611     10611 1 20333 sub data { $_[0]{data} }
29 10550     10550 1 27167 sub flags { $_[0]{flags} }
30 10618     10618 1 28552 sub mtime { $_[0]{mtime} }
31 10618     10618 1 29212 sub atime { $_[0]{atime} }
32 10618     10618 1 27655 sub btime { $_[0]{btime} }
33 31039     31039 1 51040 sub align { $_[0]{align} }
34 30687     30687 1 54407 sub device_offset { $_[0]{device_offset} }
35 21233     21233 1 56655 sub cluster { $_[0]{cluster} }
36 21135     21135 1 44312 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__