stat 的名字接口

File::stat - stat 的名字接口

名字为:dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, and blocks.

语法:

 use File::stat;

 $st = stat($file) or die "No $file: $!";

 if ( ($st->mode & 0111) && $st->nlink > 1) ) {

     print "$file is executable with lotsa links\n";

 } 



 if ( -x $st ) {

     print "$file is executable\n";

 }



 use Fcntl "S_IRUSR";

 if ( $st->cando(S_IRUSR, 1) ) {

     print "My effective uid can read $file\n";

 }



 use File::stat qw(:FIELDS);

 stat($file) or die "No $file: $!";

 if ( ($st_mode & 0111) && ($st_nlink > 1) ) {

     print "$file is executable with lotsa links\n";

你可能感兴趣的:(接口)