= stat($filename);
Not all fields are supported on all filesystem types. Here are the
-meaning of the fields:
+meanings of the fields:
0 dev device number of filesystem
1 ino inode number
(The epoch was at 00:00 January 1, 1970 GMT.)
-(*) The ctime field is non-portable, in particular you cannot expect
+(*) The ctime field is non-portable. In particular, you cannot expect
it to be a "creation time", see L<perlport/"Files and Filesystems">
for details.
-If stat is passed the special filehandle consisting of an underline, no
+If C<stat> is passed the special filehandle consisting of an underline, no
stat is done, but the current contents of the stat structure from the
-last stat or filetest are returned. Example:
+last C<stat>, C<lstat>, or filetest are returned. Example:
if (-x $file && (($d) = stat(_)) && $d < 0) {
print "$file is executable NFS file\n";
$is_setgid = S_ISDIR($mode);
You could write the last two using the C<-u> and C<-d> operators.
-The commonly available S_IF* constants are
+The commonly available C<S_IF*> constants are
# Permissions: read, write, execute, for user, group, others.
S_IREAD S_IWRITE S_IEXEC
-and the S_IF* functions are
+and the C<S_IF*> functions are
S_IMODE($mode) the part of $mode containing the permission bits
and the setuid/setgid/sticky bits
which can be bit-anded with e.g. S_IFREG
or with the following functions
- # The operators -f, -d, -l, -b, -c, -p, and -s.
+ # The operators -f, -d, -l, -b, -c, -p, and -S.
S_ISREG($mode) S_ISDIR($mode) S_ISLNK($mode)
S_ISBLK($mode) S_ISCHR($mode) S_ISFIFO($mode) S_ISSOCK($mode)
S_ISENFMT($mode) S_ISWHT($mode)
See your native chmod(2) and stat(2) documentation for more details
-about the S_* constants. To get status info for a symbolic link
+about the C<S_*> constants. To get status info for a symbolic link
instead of the target file behind the link, use the C<lstat> function.
=item study SCALAR
$Is_VMS = $^O eq 'VMS';
$Is_DGUX = $^O eq 'dgux';
$Is_MPRAS = $^O =~ /svr4/ && -f '/etc/.relid';
+$Is_Rhapsody= $^O eq 'rhapsody';
$Is_Dosish = $Is_Dos || $Is_OS2 || $Is_MSWin32 || $Is_NetWare || $Is_Cygwin;
!isnt($mtime, $ctime, 'hard link ctime != mtime') ) {
print STDERR <<DIAG;
# Check if you are on a tmpfs of some sort. Building in /tmp sometimes
-# has this problem. Also building on the ClearCase VOBS filesystem may
+# has this problem. Building on the ClearCase VOBS filesystem may also
# cause this failure.
-# Darwins UFS doesn't have a ctime concept, and thus is
-# expected to fail this test.
+#
+# Darwin's UFS doesn't have a ctime concept, and thus is expected to fail
+# this test.
DIAG
}
}
ok(-w $tmpfile, ' -w');
SKIP: {
- skip "-x simply determins if a file ends in an executable suffix", 1
+ skip "-x simply determines if a file ends in an executable suffix", 1
if $Is_Dosish || $Is_MacOS;
ok(-x $tmpfile, ' -x');
if $Is_MSWin32 || $Is_NetWare || $Is_Dos;
skip "/dev isn't available to test against", 6
unless -d '/dev' && -r '/dev' && -x '/dev';
- skip "Skipping; unexpected ls output in MP-RAS", 6
+ skip "Skipping: unexpected ls output in MP-RAS", 6
if $Is_MPRAS;
my $LS = $Config{d_readlink} ? "ls -lL" : "ls -l";
SKIP: {
skip "These tests require a TTY", 4 if $ENV{PERL_SKIP_TTY_TEST};
- my $TTY = $^O eq 'rhapsody' ? "/dev/ttyp0" : "/dev/tty";
+ my $TTY = $Is_Rhapsody ? "/dev/ttyp0" : "/dev/tty";
SKIP: {
skip "Test uses unixisms", 2 if $Is_MSWin32 || $Is_NetWare;