File Coverage

blib/lib/DataStore/CAS/FS/DirEnt.pm
Criterion Covered Total %
statement 27 37 72.9
branch 3 4 75.0
condition 4 8 50.0
subroutine 15 24 62.5
pod 21 21 100.0
total 70 94 74.4


line stmt bran cond sub pod time code
1             package DataStore::CAS::FS::DirEnt;
2 9     9   5679 use strict;
  9         23  
  9         314  
3 9     9   46 use warnings;
  9         18  
  9         1139  
4              
5             our $VERSION= '0.011000';
6              
7             # ABSTRACT: Light-weight Immutable Directory Entry Object
8              
9              
10             # We expect other subclasses to be based on different native objects, like
11             # arrays, so our accessor pulls from the 'as_hash' so that it can safely
12             # return undef if the subclass doesn't support it.
13             BEGIN {
14             eval "sub $_ { \$_[0]->as_hash->{$_} }; 1" or die $@
15 9   50 9 1 1351 for qw(
  0     0 1 0  
  0     0 1 0  
  0     0 1 0  
  3     3 1 17  
  779     779 1 2921  
  296     296 1 1150  
  0     0 1 0  
  1708     1708 1 6279  
  0     0 1 0  
  0     0 1 0  
  0     0 1 0  
  3     3 1 16  
  3     3 1 14  
  0     0 1 0  
  3     3 1 17  
  0     0 1 0  
  3     3 1 17  
  3     3   13  
16             name
17             type
18             ref
19             size
20             create_ts
21             modify_ts
22             access_ts
23             metadata_ts
24             unix_uid
25             unix_user
26             unix_gid
27             unix_group
28             unix_mode
29             unix_dev
30             unix_inode
31             unix_nlink
32             unix_blocksize
33             unix_blockcount
34             );
35 9         33 *unix_atime= *access_ts;
36 9         19 *unix_ctime= *metadata_ts;
37 9         1486 *unix_mtime= *modify_ts;
38             }
39              
40              
41             sub new {
42 167     167 1 556342 my $class= shift;
43 167 100 66     1050 my $hash= (@_ == 1 and CORE::ref $_[0] eq 'HASH')? $_[0] : { @_ };
44 167         1067 bless \$hash, $class;
45             }
46              
47              
48             sub clone {
49 15     15 1 38 my $self= shift;
50 15         41 CORE::ref($self)->new(
51 0         0 %{$self->as_hash},
52 15 50 33     49 (@_ == 1 and CORE::ref $_[0] eq 'HASH')? @{$_[0]} : @_
53             );
54             }
55              
56              
57 2845     2845 1 3907 sub as_hash { ${$_[0]} }
  2845         19228  
58              
59             1;
60              
61             __END__