APR::Finfo - Perl API for APR fileinfo structure
XXX: Besides working through the doc we need to get good constant names from libapr (needs apr patching)
use APR::Finfo ();
META: to be completed
APR fileinfo structure provides somewhat similar information to Perl's stat() call, but you will want to use this module's API to query an already stat()'ed filehandle to avoid an extra system call or to query attributes specific to APR file handles.
stat()
stat()'ed
During the HTTP request handlers coming after PerlMapToStorageHandler, $r->finfo already contains the cached values from the apr's stat() call. So you don't want to perform it again, but instead get the ARP::Finfo object via:
PerlMapToStorageHandler
$r->finfo
ARP::Finfo
my $finfo = $r->finfo;
APR::Finfo provides the following functions and/or methods:
APR::Finfo
stat
Get the specified file's stats. The file is specified by filename, instead of using a pre-opened file.
$finfo = stat($fname, $wanted_fields, $pool);
$fname
The path to the file to stat().
$wanted
The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
XXX
$pool
the pool to use to allocate the new file.
$finfo
pool
META: Autogenerated - needs to be reviewed/completed
Allocates memory and closes lingering handles in the specified pool
$ret = $obj->pool($newval);
$obj
$newval
APR::Pool
valid
The bitmask describing valid fields of this apr_finfo_t structure including all available 'wanted' fields and potentially more
$ret = $obj->valid($newval);
protection
The access permissions of the file. Mimics Unix access rights.
$ret = $obj->protection($newval);
filetype
The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE, APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE. If the type cannot be determined, the value is APR_UNKFILE.
$ret = $obj->filetype($newval);
user
The user id that owns the file
$ret = $obj->user($newval);
Note that this method may not be meaningful on all platforms, most notably Win32.
group
The group id that owns the file
$ret = $obj->group($newval);
Note that this method may not be meaningful on all platforms, most notably Win32. Incorrect results have also been reported on some versions of OSX.
inode
The inode of the file.
$ret = $obj->inode($newval);
device
The id of the device the file is on.
$ret = $obj->device($newval);
nlink
The number of hard links to the file.
$ret = $obj->nlink($newval);
size
The size of the file
$ret = $obj->size($newval);
csize
The storage size consumed by the file
$ret = $obj->csize($newval);
atime
The time the file was last accessed
$ret = $obj->atime($newval);
Note that this method may not be reliable on all platforms, most notably Win32 - FAT32 filesystems appear to work properly but NTFS filesystems do not.
mtime
The time the file was last modified
$ret = $obj->mtime($newval);
ctime
The time the file was last changed
$ret = $obj->ctime($newval);
fname
The pathname of the file (possibly unrooted)
$ret = $obj->fname($newval);
name
The file's name (no path) in filesystem case
$ret = $obj->name($newval);
mod_perl 2.0 documentation.
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.
The mod_perl development team and numerous contributors.
To install mod_perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm mod_perl
CPAN shell
perl -MCPAN -e shell install mod_perl
For more information on module installation, please visit the detailed CPAN module installation guide.