The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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)

Synopsis

  use APR::Finfo ();

META: to be completed

Description

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.

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:

  my $finfo = $r->finfo;

API

APR::Finfo provides the following functions and/or methods:

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);
arg1: $fname ( string )

The path to the file to stat().

arg2: $wanted ( string )

The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values

XXX

arg3: $pool ( integer )

the pool to use to allocate the new file.

ret: $finfo ( APR::Finfo )
since: 1.99_12

pool

META: Autogenerated - needs to be reviewed/completed

Allocates memory and closes lingering handles in the specified pool

  $ret = $obj->pool($newval);
obj: $obj ( APR::Finfo )
arg1: $newval ( APR::Pool )
since: 1.99_12

valid

META: Autogenerated - needs to be reviewed/completed

The bitmask describing valid fields of this apr_finfo_t structure including all available 'wanted' fields and potentially more

  $ret = $obj->valid($newval);
obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

protection

META: Autogenerated - needs to be reviewed/completed

The access permissions of the file. Mimics Unix access rights.

  $ret = $obj->protection($newval);
obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

filetype

META: Autogenerated - needs to be reviewed/completed

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);
obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

user

META: Autogenerated - needs to be reviewed/completed

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.

obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

group

META: Autogenerated - needs to be reviewed/completed

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.

obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

inode

META: Autogenerated - needs to be reviewed/completed

The inode of the file.

  $ret = $obj->inode($newval);

Note that this method may not be meaningful on all platforms, most notably Win32.

obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

device

META: Autogenerated - needs to be reviewed/completed

The id of the device the file is on.

  $ret = $obj->device($newval);

Note that this method may not be meaningful on all platforms, most notably Win32.

obj: $obj ( APR::Finfo )
arg1: $newval (number)
since: 1.99_12

META: Autogenerated - needs to be reviewed/completed

The number of hard links to the file.

  $ret = $obj->nlink($newval);
obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

size

META: Autogenerated - needs to be reviewed/completed

The size of the file

  $ret = $obj->size($newval);
obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

csize

META: Autogenerated - needs to be reviewed/completed

The storage size consumed by the file

  $ret = $obj->csize($newval);
obj: $obj ( APR::Finfo )
arg1: $newval ( integer )
since: 1.99_12

atime

META: Autogenerated - needs to be reviewed/completed

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.

obj: $obj ( APR::Finfo )
arg1: $newval (number)
since: 1.99_12

mtime

META: Autogenerated - needs to be reviewed/completed

The time the file was last modified

  $ret = $obj->mtime($newval);
obj: $obj ( APR::Finfo )
arg1: $newval (number)
since: 1.99_12

ctime

META: Autogenerated - needs to be reviewed/completed

The time the file was last changed

  $ret = $obj->ctime($newval);
obj: $obj ( APR::Finfo )
arg1: $newval (number)
since: 1.99_12

fname

META: Autogenerated - needs to be reviewed/completed

The pathname of the file (possibly unrooted)

  $ret = $obj->fname($newval);
obj: $obj ( APR::Finfo )
arg1: $newval ( string )
since: 1.99_12

name

META: Autogenerated - needs to be reviewed/completed

The file's name (no path) in filesystem case

  $ret = $obj->name($newval);
obj: $obj ( APR::Finfo )
arg1: $newval ( string )
since: 1.99_12

See Also

mod_perl 2.0 documentation.

Copyright

mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.

Authors

The mod_perl development team and numerous contributors.