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   2349 use strict;
  9         10  
  9         197  
3 9     9   26 use warnings;
  9         9  
  9         865  
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 623 for qw(
  0     0 1 0  
  0     0 1 0  
  0     0 1 0  
  3     3 1 7  
  779     779 1 1345  
  296     296 1 525  
  0     0 1 0  
  1708     1708 1 2961  
  0     0 1 0  
  0     0 1 0  
  0     0 1 0  
  3     3 1 6  
  3     3 1 6  
  0     0 1 0  
  3     3 1 7  
  0     0 1 0  
  3     3 1 7  
  3     3   7  
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         23 *unix_atime= *access_ts;
36 9         17 *unix_ctime= *metadata_ts;
37 9         992 *unix_mtime= *modify_ts;
38             }
39              
40              
41             sub new {
42 167     167 1 43067 my $class= shift;
43 167 100 66     539 my $hash= (@_ == 1 and CORE::ref $_[0] eq 'HASH')? $_[0] : { @_ };
44 167         405 bless \$hash, $class;
45             }
46              
47              
48             sub clone {
49 15     15 1 17 my $self= shift;
50             CORE::ref($self)->new(
51 15         18 %{$self->as_hash},
52 15 50 33     16 (@_ == 1 and CORE::ref $_[0] eq 'HASH')? @{$_[0]} : @_
  0         0  
53             );
54             }
55              
56              
57 2845     2845 1 1888 sub as_hash { ${$_[0]} }
  2845         9612  
58              
59             1;
60              
61             __END__