Skip to content

Commit 0d88b21

Browse files
committed
Better examples for .basename and .dirname
Old examples were not as clear as they could have been, and did not show examples for all the cases the user may want to know the result of.
1 parent a73747f commit 0d88b21

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/Type/IO/Path.pod6

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Returns the absolute path as a string.
5555
Returns the basename part of the path object. That is, it returns the name of
5656
the file relative to its directory.
5757
58-
say IO::Path.new("/etc/passwd").basename; # passwd
58+
say IO::Path.new("docs/README.pod").basename; # README.pod
5959
6060
=head2 method extension
6161
@@ -72,7 +72,9 @@ Returns the extension (if any) of the path object.
7272
Returns the directory name portion of the path object. That is, it returns
7373
the path excluding the volume and the base name.
7474
75-
say IO::Path.new("/etc/passwd").dirname; # /etc
75+
say IO::Path.new("/home/camelia/myfile.p6").dirname; # /home/camelia
76+
say IO::Path.new("/home/camelia").dirname; # /home
77+
say IO::Path.new("/home").dirname; # /
7678
7779
=head2 method volume
7880

0 commit comments

Comments
 (0)