File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -473,6 +473,23 @@ is dependant on the operating system. The method will L«C<fail>|/routine/fail»
473
473
with C < X::IO::DoesNotExist > if the path points to a non-existent filesystem
474
474
entity.
475
475
476
+ = head2 method sibling
477
+
478
+ method sibling(IO::Path:D: Str() $sibling --> IO::Path:D)
479
+
480
+ Allows to reference a sibling file or directory. Returns a new
481
+ L « C < IO::Path > |/type/IO::Path» based on the invocant, with the
482
+ # L « C < .basename > |/type/IO::Path#method_basename» changed to C < $sibling > . The
483
+ C < $sibling > is allowed to be a multi-part path fragment, although
484
+ # L « C < .add > |/type/IO::Path#method_add» is a better choice for such use.
485
+
486
+ say '.bashrc'.IO.sibling: '.bash_aliases'; # OUTPUT: «.bash_aliases".IO»
487
+ say '/home/camelia/.bashrc'.IO.sibling: '.bash_aliases';
488
+ # OUTPUT: «/home/camelia/.bash_aliases".IO»
489
+
490
+ say '/foo/' .IO.sibling: 'bar'; # OUTPUT: «/bar".IO»
491
+ say '/foo/.'.IO.sibling: 'bar'; # OUTPUT: «/foo/bar".IO»
492
+
476
493
= head2 routine slurp
477
494
478
495
multi method slurp(IO::Path:D: :$bin, :$enc)
You can’t perform that action at this time.
0 commit comments