| 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 | ▶ | use 5.016003; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 38 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 39 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 40 | |||||||||||
| 41 | 1 | ▶ | use base qw (File::stat); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 42 | |||||||||||
| 43 | 1 | our @EXPORT = qw (stat2); | |||||||||
| 44 | 1 | our $VERSION = '0.03'; | |||||||||
| 45 | |||||||||||
| 46 | 1 | require XSLoader; | |||||||||
| 47 | 1 | XSLoader::load('File::stat2', $VERSION); | |||||||||
| 48 | |||||||||||
| 49 | sub stat2 | ||||||||||
| 50 | 2 | ▶ | { | ||||||||
|
Subroutine
stat2: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 51 | 2 | ▶ | if (my @st = &_stat2 ($_[0])) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | { | ||||||||||
| 53 | 1 | return bless \@st, __PACKAGE__; | |||||||||
| 54 | } | ||||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 1 | 1; | |||||||||