@@ -24,6 +24,11 @@ L<IO::Path::Cygwin>, L<IO::Path::QNX>.
24
24
The rest of this document silently assumes Unix semantics in its examples,
25
25
unless when stated otherwise.
26
26
27
+ = comment TODO: Investigate if the $SPEC = $*SPEC, :$CWD = $*CWD params that
28
+ a bunch of these routines have in their signature in Rakudo, are
29
+ "official" Perl 6 API, and if so, document them here in a central
30
+ place so all the routine documentations can link to it without
31
+ having to repeat it.
27
32
28
33
= head1 Methods
29
34
@@ -201,8 +206,7 @@ Changes the POSIX permissions of a file (or in the subroutine form, any number
201
206
of files) to C < $mode > .
202
207
203
208
The subroutine form returns the names of the files for which setting the new
204
- mode was successful. The method form returns True on success, and otherwise a
205
- C < Failure > (wrapping an C < X::IO::Chmod > exception).
209
+ mode was successful. The method form returns True on success, and otherwise L < fails|/routine/fail > with L < X::IO::Chmod > .
206
210
207
211
The mode is expected as an integer following the L < standard numeric notation|
208
212
http://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation > , and is
@@ -217,24 +221,46 @@ number (or string containing a decimal number):
217
221
218
222
chmod '0444', 'myfile'; # BAD!!! (interpreted as mode 0o674)
219
223
220
- = head2 method rename
224
+ = head2 routine rename
221
225
222
- multi method rename(IO::Path:D: IO::Path:D $to, :$createonly);
226
+ method rename(IO::Path:D: $to, :$createonly --> Bool);
227
+ sub rename($from, $to, :$createonly --> Bool);
223
228
224
- Like L < /routine/rename() > , but with L < /.absolute > as the first parameter.
229
+ Renames a file. Both C < $from > (the file to be renamed) and C < $to > (the
230
+ destination) can take arbitrary paths. If C < :createonly > is set to C < True > , the
231
+ rename fails if a file already exists in the destination. Returns C < True > upon
232
+ success, or L < fails|/routine/fail > with L < X::IO::Rename > if the operation could
233
+ not be completed.
225
234
226
- = head2 method move
235
+ Please use L < move|/routine/move > if a file could not be moved by renaming (usually
236
+ because the destination is on a different physical storage device).
227
237
228
- method move(IO::Path:D $to, :$createonly)
238
+ = head2 routine move
229
239
230
- Like L < /routine/move() > , but with L < /.absolute > as the first parameter.
240
+ method move(IO::Path:D: $to, :$createonly)
241
+ sub move($from, $to, :$createonly);
231
242
232
- = head2 method unlink
243
+ Moves a file. Both C < $from > (the file to be moved) and C < $to > (the destination)
244
+ can take arbitrary paths. If C < :createonly > is set to C < True > , the move fails
245
+ if a file already exists in the destination. Returns C < True > upon success, or
246
+ L < fails|/routine/fail > with L < X::IO::Move > if the operation could not be
247
+ completed.
233
248
234
- method unlink(IO::Path:D:);
249
+ Please use L < rename|/routine/rename > if a file can be moved by renaming (which is
250
+ usually possible if the destination is on the same different physical storage
251
+ device).
235
252
236
- Like L < /routine/unlink() > , but with L < /.absolute > as the first parameter.
237
- Returns C < True > on success or an appropriate C < Failure > .
253
+ B < NOTE > : This function has not yet been implemented in Rakudo.
254
+
255
+ = head2 routine unlink
256
+
257
+ method unlink(IO::Path:D: --> Bool);
258
+ sub unlink(*@filenames --> @success-filenames);
259
+
260
+ Delete all specified ordinary files, links, or symbolic links.
261
+
262
+ The subroutine form returns the names of the files that were successfully
263
+ deleted. The method form returns C < True > on success, or L < fails|/routine/fail > with L < X::IO::Unlink > if the operation could not be completed.
238
264
239
265
= head1 Related roles and classes
240
266
0 commit comments