File Coverage

blib/lib/File/stat2.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 20 21 95.2


line stmt bran cond sub pod time code
1             package File::stat2;
2              
3             =head1 NAME
4              
5             File::stat2 -- similar to File::stat, but with access/create/modification times down to nanosecond
6              
7             =head1 SYNOPSIS
8              
9             Same interface as File::stat :
10              
11             use File::stat;
12             use File::stat2;
13            
14             my $st1 = stat ($file);
15             my $st2 = stat2 ($file);
16              
17             but times are double precision numbers instead of bare integers :
18              
19             print $st1->mtime (); # 1733990636
20             print $st2->mtime (); # 1733990636.8844
21              
22             =head1 DESCRIPTION
23              
24             File::stat is great, but it is not possible to access time stamps
25             with the highest possible precision. File::stat2 solves this issue.
26              
27             =head1 SEE ALSO
28              
29             File::stat, stat (2)
30              
31             =head1 AUTHOR
32              
33             pmarguinaud@hotmail.com
34              
35             =cut
36              
37 1     1   170292 use 5.016003;
  1         4  
38 1     1   7 use strict;
  1         2  
  1         50  
39 1     1   6 use warnings;
  1         2  
  1         71  
40              
41 1     1   7 use base qw (File::stat);
  1         2  
  1         1412  
42              
43             our @EXPORT = qw (stat2);
44             our $VERSION = '0.03';
45              
46             require XSLoader;
47             XSLoader::load('File::stat2', $VERSION);
48              
49             sub stat2
50             {
51 2 100   2 0 243111 if (my @st = &_stat2 ($_[0]))
52             {
53 1         9 return bless \@st, __PACKAGE__;
54             }
55             }
56              
57             1;