1docs::api::APR::Finfo(3U)ser Contributed Perl Documentatidooncs::api::APR::Finfo(3)
2
3
4
6 APR::Finfo - Perl API for APR fileinfo structure
7
9 use APR::Finfo ();
10 use APR::Const -compile => qw(FINFO_NORM);
11 my $finfo = APR::Finfo::stat("/tmp/test", APR::Const::FINFO_NORM, $pool);
12
13 $device = $finfo->device; # (stat $file)[0]
14 $inode = $finfo->inode; # (stat $file)[1]
15 # stat returns an octal number while protection is hex
16 $prot = $finfo->protection; # (stat $file)[2]
17 $nlink = $finfo->nlink; # (stat $file)[3]
18 $gid = $finfo->group; # (stat $file)[4]
19 $uid = $finfo->user; # (stat $file)[5]
20 $size = $finfo->size; # (stat $file)[7]
21 $atime = $finfo->atime; # (stat $file)[8]
22 $mtime = $finfo->mtime; # (stat $file)[9]
23 $ctime = $finfo->ctime; # (stat $file)[10]
24
25 $csize = $finfo->csize; # consumed size: not portable!
26
27 $filetype = $finfo->filetype; # file/dir/socket/etc
28
29 $fname = $finfo->fname;
30 $name = $finfo->name; # in filesystem case:
31
32 # valid fields that can be queried
33 $valid = $finfo->valid;
34
36 APR fileinfo structure provides somewhat similar information to Perl's
37 stat() call, but you will want to use this module's API to query an
38 already "stat()'ed" filehandle to avoid an extra system call or to
39 query attributes specific to APR file handles.
40
41 During the HTTP request handlers coming after
42 "PerlMapToStorageHandler", "$r->finfo" already contains the cached
43 values from the apr's stat() call. So you don't want to perform it
44 again, but instead get the "ARP::Finfo" object via:
45
46 my $finfo = $r->finfo;
47
49 "APR::Finfo" provides the following functions and/or methods:
50
51 "atime"
52 Get the time the file was last accessed:
53
54 $atime = $finfo->atime;
55
56 obj: $finfo ( "APR::Finfo object" )
57 return: $atime ( integer )
58 Last access time in seconds since the epoch
59
60 since: 2.0.00
61
62 This method returns the same value as Perl's:
63
64 (stat $filename)[8]
65
66 Note that this method may not be reliable on all platforms, most
67 notably Win32 -- FAT32 filesystems appear to work properly, but NTFS
68 filesystems do not.
69
70 "csize"
71 Get the storage size consumed by the file
72
73 $csize = $finfo->csize;
74
75 obj: $finfo ( "APR::Finfo object" )
76 return: $csize ( integer )
77 since: 2.0.00
78
79 Chances are that you don't want to use this method, since its
80 functionality is not supported on most platforms (in which case it
81 always returns 0).
82
83 "ctime"
84 Get the time the file was last changed
85
86 $ctime = $finfo->ctime;
87
88 obj: $finfo ( "APR::Finfo object" )
89 return: $ctime ( integer )
90 Inode change time in seconds since the epoch
91
92 since: 2.0.00
93
94 This method returns the same value as Perl's:
9