Author: wayland
Date: 2009-08-19 03:57:49 +0200 (Wed, 19 Aug 2009)
New Revision: 28026
Modified:
docs/Perl6/Spec/S16-io.pod
docs/Perl6/Spec/S32-setting-library/IO.pod
Log:
[S32/IO] put in canonpath and realpath, as promised
[S16] Things including:
* Made defaults more sensible (lax vs. strict mode)
* Added "use path" pragma
* Added :local, :modern, :portable, and :posix
Modified: docs/Perl6/Spec/S16-io.pod
===================================================================
--- docs/Perl6/Spec/S16-io.pod 2009-08-19 00:26:55 UTC (rev 28025)
+++ docs/Perl6/Spec/S16-io.pod 2009-08-19 01:57:49 UTC (rev 28026)
@@ -101,9 +101,23 @@
operator. Most of these are filesystem-specific. They confine what can be
included in a filename.
+Any path that starts with a "/" is considered an absolute path, otherwise
+the path is considered relative.
+
=head3 Default constraints
-The default paths are portable POSIX paths (see POSIX.1-2008 sections
+The default constraints can be set with the "use path" pragma, for example:
+
+ use path :posix;
+ use path :modern;
+ use path :local;
+
+The default when in strict mode is "use path :posix", whereas the default in
+lax mode is "use path :local".
+
+=head3 :posix constraints
+
+The :modern set of constraints paths are portable POSIX paths (see
POSIX.1-2008 sections
4.7 and 3.276). If platform/filesystem specific behavior is needed,
specific constraints should be applied as needed (see below).
@@ -114,8 +128,26 @@
Any path that starts with a "/" is considered an absolute path, otherwise
the path is considered relative.
-=head3 Windows-style constraints
+=head3 :portable
+In addition to the POSIX constraints above, the path should fit into 8
+characters, followed by a full stop, and then three more characters. Only
+the one full stop should appear in the filename. Additionally, no path
+may be longer than 64 characters.
+
+=head3 :local
+
+This is :win on a Windows platform, :unix on a Unix platform, etc. Note
+that this is specifically not portable between platforms with different
+constraint sets.
+
+=head3 :modern constraints
+
+The :modern set of constraints are the same as :posix, except that they
+may contain any UTF-8 character, rather than just those listed.
+
+=head3 :win constraints
+
We allow Windows style paths so converting and maintaining code on this
platform is not a pain.
@@ -124,7 +156,7 @@
Note that this specifically excludes the backslash quoting usually used with
q{}.
-=head3 Unix-style constraints
+=head3 :unix constraints
For Unix specific behavior we have a p:unix{} literal. Here the only
limits are what is defined by the locale and the filesystem type. So we won't
@@ -132,7 +164,9 @@
my Path $path = p:unix{/usr/src/bla/myfile?:%.file};
-And for cases where this is a problem p:bin{} can be used as no checking is
+=head3 :bin constraints (no constraints at all)
+
+If the above are causing problems, p:bin{} can be used as no checking is
done here, other than assuming that / is the separator.
=head3 Other constraints
Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/IO.pod 2009-08-19 00:26:55 UTC (rev
28025)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod 2009-08-19 01:57:49 UTC (rev
28026)
@@ -769,17 +769,24 @@
Returns @.elements concatenated together for use as a string. Usually this
is the path that it was originally created with.
+=item canonpath
+
+ method canonpath( --> Str);
+
+No physical check on the filesystem, but a logical cleanup of a path.
+
=item realpath
method realpath( --> Str);
Gets the real path to the object, resolving softlinks/shortcuts, etc
-=item realisepath
+=item resolvepath
- method realisepath();
+ method resolvepath(Array of Str @:Types --> Str);
-Changes the Path object to point at whatever is returned by C<.realpath()>.
+...@types can contain "real" and "canon", in any order, and the
+method will run realpath and canonpath in the order specified.
=item ACCEPTS