.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "File::lchown 3pm" .TH File::lchown 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME "File::lchown" \- modify attributes of symlinks without dereferencing them .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use File::lchown qw( lchown lutimes ); \& \& lchown $uid, $gid, $linkpath or die "Cannot lchown() \- $!"; \& \& lutimes $atime, $mtime, $linkpath or die "Cannot lutimes() \- $!"; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The regular \f(CW\*(C`chown\*(C'\fR system call will dereference a symlink and apply ownership changes to the file at which it points. Some OSes provide system calls that do not dereference a symlink but instead apply their changes directly to the named path, even if that path is a symlink (in much the same way that \f(CW\*(C`lstat\*(C'\fR will return attributes of a symlink rather than the file at which it points). .SH FUNCTIONS .IX Header "FUNCTIONS" .ie n .SS "$count = lchown $uid, $gid, @paths" .el .SS "\f(CW$count\fP = lchown \f(CW$uid\fP, \f(CW$gid\fP, \f(CW@paths\fP" .IX Subsection "$count = lchown $uid, $gid, @paths" Set the new user or group ownership of the specified paths, without dereferencing any symlinks. Passing the value \f(CW\-1\fR as either the \f(CW$uid\fR or \&\f(CW$gid\fR will leave that attribute unchanged. Returns the number of files successfully changed. .ie n .SS "$count = lutimes $atime, $mtime, @paths" .el .SS "\f(CW$count\fP = lutimes \f(CW$atime\fP, \f(CW$mtime\fP, \f(CW@paths\fP" .IX Subsection "$count = lutimes $atime, $mtime, @paths" Set the access and modification times on the specified paths, without dereferencing any symlinks. Passing \f(CW\*(C`undef\*(C'\fR as both \f(CW$atime\fR and \f(CW$mtime\fR will update the times to the current system time. .PP Note that for both \f(CW\*(C`lchown\*(C'\fR and \f(CW\*(C`lutimes\*(C'\fR, if more than one path is given, if later paths succeed after earlier failures, then the value of \f(CW$!\fR will not be reliable to indicate the nature of the failure. If you wish to use \&\f(CW$!\fR to report on failures, make sure only to pass one path at a time. .SH TODO .IX Header "TODO" .IP \(bu 4 Implement sub-second precision on \f(CW\*(C`lutimes\*(C'\fR, most likely by taking floats or two-element ARRAY refs, similar to \f(CW\*(C`Time::HiRes\*(C'\fR uses. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 \&\f(CWlchown(2)\fR \- change ownership of a file .IP \(bu 4 \&\f(CWlutimes(2)\fR \- change file timestamps .SH AUTHOR .IX Header "AUTHOR" Paul Evans