File::stat

use File::stat;
$st = stat($file)      or die "Can't stat $file: $!";
if ($st->mode & 0111 and $st->nlink > 1)) {
    print "$file is executable with many links
";
}

use File::stat ":FIELDS";
stat($file)            or die "Can't stat $file: $!";
if ($st_mode & 0111 and $st_nlink > 1) ) {
    print "$file is executable with many links
";
}

@statinfo = CORE::stat($file);    # Access overridden built-in.

The File::stat module provides a method interface to Perl's built-in stat and lstat functions by replacing them with versions that return a File::stat object (or undef on failure). This object has methods that return the like-named structure field name from the traditional stat (2) syscall; namely, dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, and blocks. You may also import the structure fields into your own namespace as regular variables using the ":FIELDS" import tag. (This still overrides your stat and lstat built-ins.) These fields show up as scalar variables named with a "st_" in front of the field name. That is, the $st_dev variable corresponds to the $st->dev method.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset