File Coverage

blib/lib/File/Stat.pm
Criterion Covered Total %
statement 12 35 34.2
branch 0 6 0.0
condition n/a
subroutine 4 25 16.0
pod 0 21 0.0
total 16 87 18.3


line stmt bran cond sub pod time code
1             package File::Stat;
2 1     1   15496 use 5.006;
  1         4  
  1         47  
3 1     1   6 use strict;
  1         2  
  1         43  
4 1     1   6 use warnings;
  1         35  
  1         42  
5 1     1   4 use base qw(Exporter);
  1         2  
  1         2286  
6             our $VERSION = '0.01';
7             our @EXPORT = qw();
8             our %EXPORT_TAGS = (
9             'stat' => [qw(&stat)],
10             'lstat' => [qw(&lstat)],
11             'override' => [qw(&lstat &stat)],
12             'global' => [qw(
13             $st_dev $st_ino $st_inode $st_mode $st_nlink $st_uid $st_gid
14             $st_rdev $st_size $st_atime $st_mtime $st_ctime $st_blksize $st_blocks
15             )],
16             );
17             $EXPORT_TAGS{all} = [ map {@{$EXPORT_TAGS{$_}}} keys %EXPORT_TAGS ];
18             our @EXPORT_OK = @{$EXPORT_TAGS{all}};
19              
20             our($st_dev,$st_ino,$st_inode,$st_mode,$st_nlink,$st_uid,$st_gid,
21             $st_rdev,$st_size,$st_atime,$st_mtime,$st_ctime,$st_blksize,$st_blocks);
22             # Preloaded methods go here.
23 0 0   0 0   sub class {ref$_[0]||$_[0]}
24 0     0 0   sub new {bless [stat($_[1])],$_[0]->class;}
25 0     0 0   sub stat_ {CORE::stat(shift)}
26 0     0 0   sub lstat_ {CORE::lstat(shift)}
27             sub set {
28             return (
29 0     0 0   $st_dev,$st_ino,$st_inode,$st_mode,$st_nlink,$st_uid,$st_gid,
30             $st_rdev,$st_size,$st_atime,$st_mtime,$st_ctime,$st_blksize,$st_blocks
31             ) = @_;
32             }
33             sub stat {
34 0 0   0 0   return new File::Stat(shift) unless(wantarray);
35 0           return set( stat_(shift) );
36             }
37             sub lstat {
38 0 0   0 0   return new File::Stat(shift) unless(wantarray);
39 0           return set( lstat_(shift) );
40             }
41 0     0 0   sub dev :method {shift()->[ 0]}
42 0     0 0   sub ino :method {shift()->[ 1]}
43 0     0 0   sub inode :method {shift()->[ 1]}
44 0     0 0   sub mode :method {shift()->[ 2]}
45 0     0 0   sub nlink :method {shift()->[ 3]}
46 0     0 0   sub uid :method {shift()->[ 4]}
47 0     0 0   sub gid :method {shift()->[ 5]}
48 0     0 0   sub rdev :method {shift()->[ 6]}
49 0     0 0   sub size :method {shift()->[ 7]}
50 0     0 0   sub atime :method {shift()->[ 8]}
51 0     0 0   sub mtime :method {shift()->[ 9]}
52 0     0 0   sub ctime :method {shift()->[10]}
53 0     0 0   sub blksize :method {shift()->[11]}
54 0     0 0   sub blocks :method {shift()->[12]}
55             1;
56             __END__