Re: [MacPerl-Porters] File::Spec catfile etc.

[email protected] (Peter Prymmer)
Newsgroups perl.perl5.porters,perl.macperl.porters,perl.vmsperl
Message-ID <[email protected]>
On Thu, 13 Sep 2001, Chris Nandor wrote:

> So did we ever come to a consensus on this issue?  I think where we left it:
>
> 1. catfile/catdir should be relative by default
> 2. if the first argument is something denoting a root-level item ('/',
> 'HD:', 'C:') or an empty string (''), then the behavior should be some sort
> of platform-specific absolute path
> 3. for real absolute paths rely on catpath
>
> Is this about right?  Or am I off-base again?

That sounds about right to me Chris.  I must offer my apology since I have
not had any time to devote to modifying VMS.pm to meet the empty string
requirement of number 2 above nor look at catpath.  In fact I am so
pre-occupied with other matters I'd like to dump a possible patch in your
respective laps :-)

I do not like to do this ordinarily - but I do have an UNTESTED patch. I
would appreciate it if vmsperlers in particular could try out the
s/access_spec/access spec/ modification to the tests for File::Spec, since
the VMS specific tests are skipped on Unix (since Unix does not build
VMS::Filespec and cannot call the SYS$PARSE system service).

As noted this was taken w.r.t. perl@11833 and could very well not be up to
date.  Modify it however you see fit.  Unfortunately I won't likely be
able to resolve any issues associated with it for several weeks.

Peter Prymmer

P.S. the MD5 update for EBCDIC looks to be in trouble.

#---------------8<--------------

It appears that change # 7758 (2000/11/20) introduced File::Spec::Epoc(.pm)
but made no mention of it in Spec.pm's pod or in the test for Spec.t.
The enclosed patch adds mention of Epoc to Spec.pm and a few (by no means
necessarily comprehensive) Epoc tests to lib/File/Spec.t.

This patch also separates the "access_spec" on VMS into "access spec"
so as to better test DECnet style file access specifications.

Files affected:

    perl@11834/lib/File/Spec.pm
    perl@11834/lib/File/Spec.t

Peter Prymmer


diff -ru perl_11833_orig/lib/File/Spec.pm perl_11833/lib/File/Spec.pm
--- perl_11833_orig/lib/File/Spec.pm	Tue Sep  4 05:34:02 2001
+++ perl_11833/lib/File/Spec.pm	Tue Sep  4 05:34:50 2001
@@ -53,6 +53,7 @@
 	File::Spec::OS2
 	File::Spec::Win32
 	File::Spec::VMS
+	File::Spec::Epoc

 The module appropriate for the current OS is automatically loaded by
 File::Spec. Since some modules (like VMS) make use of facilities available
@@ -269,14 +270,14 @@
 =back

 For further information, please see L<File::Spec::Unix>,
-L<File::Spec::Mac>, L<File::Spec::OS2>, L<File::Spec::Win32>, or
-L<File::Spec::VMS>.
+L<File::Spec::Epoc>, L<File::Spec::Mac>, L<File::Spec::OS2>,
+L<File::Spec::Win32>, or L<File::Spec::VMS>.

 =head1 SEE ALSO

-L<File::Spec::Unix>, L<File::Spec::Mac>, L<File::Spec::OS2>,
-L<File::Spec::Win32>, L<File::Spec::VMS>, L<File::Spec::Functions>,
-L<ExtUtils::MakeMaker>
+L<File::Spec::Unix>, L<File::Spec::Epoc>, L<File::Spec::Mac>,
+L<File::Spec::OS2>, L<File::Spec::Win32>, L<File::Spec::VMS>,
+L<File::Spec::Functions>, L<ExtUtils::MakeMaker>

 =head1 AUTHORS

diff -ru perl_11833_orig/lib/File/Spec.t perl_11833/lib/File/Spec.t
--- perl_11833_orig/lib/File/Spec.t	Tue Sep  4 05:34:28 2001
+++ perl_11833/lib/File/Spec.t	Tue Sep  4 06:19:16 2001
@@ -192,8 +192,8 @@
 [ "VMS->splitpath('[.d1.d2.d3]file')",                            ',[.d1.d2.d3],file'                          ],
 [ "VMS->splitpath('node::volume:[d1.d2.d3]')",                    'node::volume:,[d1.d2.d3],'                  ],
 [ "VMS->splitpath('node::volume:[d1.d2.d3]file')",                'node::volume:,[d1.d2.d3],file'              ],
-[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]')",     'node"access_spec"::volume:,[d1.d2.d3],'     ],
-[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]file')", 'node"access_spec"::volume:,[d1.d2.d3],file' ],
+[ "VMS->splitpath('node\"access spec\"::volume:[d1.d2.d3]')",     'node"access spec"::volume:,[d1.d2.d3],'     ],
+[ "VMS->splitpath('node\"access spec\"::volume:[d1.d2.d3]file')", 'node"access spec"::volume:,[d1.d2.d3],file' ],

 [ "VMS->catpath('','','file')",                                       'file'                                     ],
 [ "VMS->catpath('','[d1.d2.d3]','')",                                 '[d1.d2.d3]'                               ],
@@ -204,8 +204,8 @@
 [ "VMS->catpath('v','d1/d2/d3','file')",                              'v:[.d1.d2.d3]file'                            ],
 [ "VMS->catpath('node::volume:','[d1.d2.d3]','')",                    'node::volume:[d1.d2.d3]'                  ],
 [ "VMS->catpath('node::volume:','[d1.d2.d3]','file')",                'node::volume:[d1.d2.d3]file'              ],
-[ "VMS->catpath('node\"access_spec\"::volume:','[d1.d2.d3]','')",     'node"access_spec"::volume:[d1.d2.d3]'     ],
-[ "VMS->catpath('node\"access_spec\"::volume:','[d1.d2.d3]','file')", 'node"access_spec"::volume:[d1.d2.d3]file' ],
+[ "VMS->catpath('node\"access spec\"::volume:','[d1.d2.d3]','')",     'node"access spec"::volume:[d1.d2.d3]'     ],
+[ "VMS->catpath('node\"access spec\"::volume:','[d1.d2.d3]','file')", 'node"access spec"::volume:[d1.d2.d3]file' ],

 [ "VMS->canonpath('')",                                    ''                        ],
 [ "VMS->canonpath('volume:[d1]file')",                     'volume:[d1]file'         ],
@@ -295,6 +295,15 @@
 [ "Mac->rel2abs('::','t1:t2:t3')",           't1:t2:t3::'     ],
 [ "Mac->rel2abs('::t4','t1:t2:t3')",         't1:t2:t3::t4'   ],
 [ "Mac->rel2abs('t1','t1:t2:t3')",           't1'             ],
+
+[ "Epoc->catfile('a','b','c')",              'a/b/c'  ],
+
+[ "Epoc->catdir('A:/')",                     'A:'   ],
+
+[ "Epoc->canonpath('a:')",                   'A:'     ],
+[ "Epoc->canonpath('a:f')",                  'A:f'     ],
+
+[ "Epoc->splitpath('file')",                 ',,file' ],
 ) ;

 # Grab all of the plain routines from File::Spec
@@ -325,6 +334,7 @@

 require File::Spec::OS2 ;
 require File::Spec::Mac ;
+require File::Spec::Epoc ;

 print "1..", scalar( @tests ), "\n" ;

End of Patch.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.