Author: wayland
Date: 2009-08-20 00:04:27 +0200 (Thu, 20 Aug 2009)
New Revision: 28036
Modified:
docs/Perl6/Spec/S16-io.pod
docs/Perl6/Spec/S32-setting-library/IO.pod
Log:
[S16] Documented $*CWD which was mentioned once in S28
[S32] Changed Path to have Buf instead of Str, and an $.Encoding. More spec
will be
needed when I (or someone) understands better :).
Modified: docs/Perl6/Spec/S16-io.pod
===================================================================
--- docs/Perl6/Spec/S16-io.pod 2009-08-19 20:32:00 UTC (rev 28035)
+++ docs/Perl6/Spec/S16-io.pod 2009-08-19 22:04:27 UTC (rev 28036)
@@ -174,6 +174,23 @@
It is expected that other sets of constraints, such as VMS, DOS, and old-style
Mac will be provided by modules.
+=head2 $*CWD
+
+The global variable $*CWD is a Path object with certain special properties,
+mainly:
+ * It must check whether the path exists before changing its value
+ * It can only be assigned an absolute path; if you want to make relative
+ changes, use the Array interface
+
+$*CWD is specific to the current thread, unlike %*ENV<PATH> or the native
+getcwd/chdir path, which are both usually process-wide.
+
+The variable is used in at least these cases:
+* When a Path object is created, if the string it is given is not an absolute
+ path, then $*CWD is prepended to it.
+* When a subprocess is executed, it is executed with the current thread's
+ $*CWD as its working directory.
+
=head1 Name Services
=head2 User role
Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/IO.pod 2009-08-19 20:32:00 UTC (rev
28035)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod 2009-08-19 22:04:27 UTC (rev
28036)
@@ -660,7 +660,9 @@
Changes the current working directory to the one specified by FILENAME.
If it succeeds it returns true, otherwise it returns C<Failure> and
-sets C<$!> (errno).
+sets C<$!> (errno). Note, though, that chdir affects only the system
+directory; most things in Perl 6 that need a current directory depend
+on their thread's copy of $*CWD.
=item find
@@ -682,12 +684,21 @@
role Path does Str does Array {
has Str $.Type;
- has Array of Str @.Elements;
+ has Str $.Encoding;
+ has Array of Buf @.Elements;
has Array of IO::ACL @.ACLs;
has Hash of %.times;
...
}
+C<$.Type> can be C<File>, C<Directory>, C<Link>, or C<Other>. See
+C<.create()> method documentation for how it is set.
+
+$.Encoding tells us what the encoding is, if known. If $.Encoding is
+undefined, then there are a number of things that can't be done with it,
+such as treating is the Path as a Str, using say/print/any other display
+method on it, and those kinds of things.
+
The <@.Elements> array is a list of Str that contain the path elements, but
all are checked before being pushed onto the array.
@@ -695,13 +706,10 @@
C<Access> (and maybe others on other operating systems), and the values are
all C<Temporal::Instant> objects.
-C<$.Type> can be C<File>, C<Directory>, C<Link>, or C<Other>. See
-C<.create()> method documentation for how it is set.
+When a Path is used as a Str, it allows some operations, so that it can
+be concatenated easily with other strings. When used as an Array, it
+acts as an array of path elements.
-When used as a Str, it allows some operations, so that it can be concatenated
-easily with other strings. When used as an Array, it acts as an array of
-path elements.
-
=head3 Methods
=over 4