--- name: File::stat runtime: pp source: src/native/File/stat/pp.rs --- ```{index} single: File::stat; Perl module (pp runtime) ``` # File::stat Native implementation of File::stat Provides by-name interface to Perl's stat() builtin. Returns blessed objects with accessor methods for stat fields. # Functions ## stat Returns a blessed `File::stat` object (arrayref) for a path or filehandle. Follows symlinks. use File::stat; my $st = stat('/etc/passwd'); print $st->size, "\n"; ## lstat Like `stat`, but does not follow symlinks (uses `symlink_metadata`). use File::stat; my $st = lstat('/path/to/symlink'); print $st->mode, "\n"; ## dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, blocks Accessor methods on the blessed `File::stat` object. Each returns the corresponding field from stat(2), indexed into the underlying array. use File::stat; my $st = stat($filename); my $uid = $st->uid; my $mtime = $st->mtime;