Skip to content

Commit 5762144

Browse files
committed
Add an example of using the ourput of IO.mode as input to IO.chmod
1 parent d857a09 commit 5762144

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

doc/Type/IO/Path.pod

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,15 @@ Return an L<IntStr> object representing the POSIX permissions of a file. The
516516
Str part of the result is the octal representation of the file permission, like
517517
the form accepted by the chmod(1) utility.
518518
519-
say ~"path/to/file".IO.mode; # e.g. '0644'
520-
say +"path/to/file".IO.mode; # e.g. 420, where sprintf('%04o', 420) eq '0644'
519+
say ~"path/to/file".IO.mode; # e.g. '0644'
520+
say +"path/to/file".IO.mode; # e.g. 420, where sprintf('%04o', 420) eq '0644'
521+
522+
The result of this can be used in the other methods that take a mode as an
523+
argument.
524+
525+
"path/to/file1".IO.chmod("path/to/file2".IO.mode); # will change the
526+
# permissions of file1
527+
# to be the same as file2
521528
522529
=head1 Related roles and classes
523530

0 commit comments

Comments
 (0)