Полезная информация

Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.80 File::Spec::Win32Chapter 8
Standard Modules
Next: 8.82 FileCache

8.81 File::stat

Provides the same file status information as the Perl functions stat and lstat. Exports two functions that return File::stat objects. The objects have methods that return the equivalent fields from the Unix stat(2) call:

devDevice number of filesystem
inoInode number
modeFile mode
nlinkNumber of links to the file
uidNumeric user ID of owner
gidNumeric group ID of owner
rdevDevice identifier
sizeSize of file, in bytes
atimeLast access time
mtimeLast modified time
ctimeInode change time
blksizePreferred blocksize for filesystem I/O
blocksNumber of blocks allocated

You can access the status fields either with the methods or by importing the fields into your namespace with the :FIELDS import tag and then accessing them by prepending st_ to the field name (e.g., $st_mode). Here are examples of doing it both ways:

use File::stat;

$stats = stat($file);
print $stats->uid;
print $st_uid;

Previous: 8.80 File::Spec::Win32Perl in a NutshellNext: 8.82 FileCache
8.80 File::Spec::Win32Book Index8.82 FileCache