summaryrefslogtreecommitdiff
path: root/pod/perlfunc.pod
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>2005-07-14 19:32:50 -0700
committerH.Merijn Brand <h.m.brand@xs4all.nl>2005-07-16 08:07:44 +0000
commitc4aca7d03737ddcac23de1ad6d597e98be679214 (patch)
tree0a3a2c3042bba6da8246cf336e1c4d10f6aa61d1 /pod/perlfunc.pod
parentaec46f14fac1bc74bf8ad4054a6f9674b324f8d2 (diff)
downloadperl-c4aca7d03737ddcac23de1ad6d597e98be679214.tar.gz
Re: fchmod, fchown, fchdir
Message-ID: <lrwtnse7nh.fsf@caliper.activestate.com> + Schwern's ok -> like changes p4raw-id: //depot/perl@25157
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r--pod/perlfunc.pod20
1 files changed, 20 insertions, 0 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 447dad3fb1..b399298e74 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -603,6 +603,10 @@ previous time C<caller> was called.
=item chdir EXPR
+=item chdir FILEHANDLE
+
+=item chdir DIRHANDLE
+
=item chdir
Changes the working directory to EXPR, if possible. If EXPR is omitted,
@@ -612,6 +616,10 @@ variable C<$ENV{SYS$LOGIN}> is also checked, and used if it is set.) If
neither is set, C<chdir> does nothing. It returns true upon success,
false otherwise. See the example under C<die>.
+On systems that support fchdir, you might pass a file handle or
+directory handle as argument. On systems that don't support fchdir,
+passing handles produces a fatal error at run time.
+
=item chmod LIST
Changes the permissions of a list of files. The first element of the
@@ -627,6 +635,14 @@ successfully changed. See also L</oct>, if all you have is a string.
$mode = '0644'; chmod oct($mode), 'foo'; # this is better
$mode = 0644; chmod $mode, 'foo'; # this is best
+On systems that support fchmod, you might pass file handles among the
+files. On systems that don't support fchmod, passing file handles
+produces a fatal error at run time.
+
+ open(my $fh, "<", "foo");
+ my $perm = (stat $fh)[2] & 07777;
+ chmod($perm | 0600, $fh);
+
You can also import the symbolic C<S_I*> constants from the Fcntl
module:
@@ -712,6 +728,10 @@ successfully changed.
$cnt = chown $uid, $gid, 'foo', 'bar';
chown $uid, $gid, @filenames;
+On systems that support fchown, you might pass file handles among the
+files. On systems that don't support fchown, passing file handles
+produces a fatal error at run time.
+
Here's an example that looks up nonnumeric uids in the passwd file:
print "User: ";