Skip to content

Commit 0ca2295

Browse files
committed
[io grant] Reword/expand IO::Path intro prose
1 parent dbdc995 commit 0ca2295

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

doc/Type/IO/Path.pod6

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,36 @@
77
=for code :skip-test
88
class IO::Path is Cool does IO { }
99
10-
Built-in class for file and directory paths.
11-
12-
Conceptually, an C<IO::Path> object consists of a volume (think C<C:> on
13-
windows), a directory, and a basename.
14-
15-
C<IO::Path> supports both purely textual operations, and operations that
16-
access the file system.
17-
18-
The current working directory is available as an C<IO::Path> object in C<$*CWD>.
19-
20-
The behavior of C<IO::Path> is dependent on the operating system it runs on;
21-
to get reproducible behavior across operating systems, you can use one of its
22-
subclasses instead: L<IO::Spec::Unix>, L<IO::Spec::Win32>,
23-
L<IO::Spec::Cygwin>, L<IO::Spec::QNX>.
10+
The workhorse of IO operations.
11+
12+
Conceptually, an C<IO::Path> object consists of a volume, a directory, and a
13+
basename. It supports both purely textual operations, and operations that access
14+
the file system, e.g. to resolve a path, or to read all content of a file.
15+
16+
At creation, each C<IO::Path> object is given information about the current
17+
working directory the path might be relative to using the C<$.CWD> attribute
18+
(defaults to L«C<$*CWD>|/language/variables#Dynamic_variables»), as well as
19+
what operating system semantics should be used for path manipulation using
20+
the special L«C<IO::Spec>|/type/IO::Spec» type given in the C<$.SPEC> attribute.
21+
22+
The C<$.SPEC> defaults to the value of
23+
L«C<$*SPEC>|/language/variables#Dynamic_variables», which uses the object
24+
suitable for the operating system the code is currently running on. This is
25+
the default most code will be comfortable with.
26+
27+
In certain situations, e.g. testing, you may wish to force C<$*SPEC> to use one
28+
of the specific SPEC modules: L«C<IO::Spec::Unix>|/type/IO::Spec::Unix»,
29+
L«C<IO::Spec::Win32>|/type/IO::Spec::Win32»,
30+
L«C<IO::Spec::Cygwin>|/type/IO::Spec::Cygwin», and
31+
L«C<IO::Spec::QNX>|/type/IO::Spec::QNX», or to create C<IO::Path> objects via
32+
shortcut subclasses L«C<IO::Path::Unix>|/type/IO::Path::Unix»,
33+
L«C<IO::Path::Win32>|/type/IO::Path::Win32»,
34+
L«C<IO::Path::Cygwin>|/type/IO::Path::Cygwin», and
35+
L«C<IO::Path::QNX>|/type/IO::Path::QNX» that pre-set the C<$.SPEC> attribute
36+
for you.
2437
2538
The rest of this document silently assumes Unix semantics in its examples,
26-
unless when stated otherwise.
39+
unless stated otherwise.
2740
2841
=head1 Methods
2942

0 commit comments

Comments
 (0)