Hello community, here is the log from the commit of package perl-Path-Class for openSUSE:Factory checked in at Thu Mar 31 14:51:46 CEST 2011.
-------- --- perl-Path-Class/perl-Path-Class.changes 2010-11-30 20:27:39.000000000 +0100 +++ /mounts/work_src_done/STABLE/perl-Path-Class/perl-Path-Class.changes 2010-12-26 15:29:55.000000000 +0100 @@ -1,0 +2,10 @@ +Sun Dec 26 14:25:07 UTC 2010 - [email protected] + +- update to 0.22: + * added a basename() method for directory objects + +- changes from 0.21: + * don't test the 'iomode' option under 5.6, because layers aren't supported yet + * fixes to spelling errors in the docmuentation + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- Path-Class-0.19.tar.bz2 New: ---- Path-Class-0.22.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Path-Class.spec ++++++ --- /var/tmp/diff_new_pack.GMo779/_old 2011-03-31 14:37:45.000000000 +0200 +++ /var/tmp/diff_new_pack.GMo779/_new 2011-03-31 14:37:45.000000000 +0200 @@ -1,7 +1,7 @@ # -# spec file for package perl-Path-Class (Version 0.19) +# spec file for package perl-Path-Class # -# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,12 +21,12 @@ Name: perl-Path-Class %define cpan_name Path-Class Summary: Cross-platform path specification manipulation -Version: 0.19 -Release: 2 +Version: 0.22 +Release: 1 License: GPL+ or Artistic Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Path-Class/ -#Source: http://www.cpan.org/modules/by-module/Path/Path-Class-%{version}.tar.gz +#Source: http://search.cpan.org/CPAN/authors/id/K/KW/KWILLIAMS/%{cpan_name}-%{version}.tar.gz Source: %{cpan_name}-%{version}.tar.bz2 BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -97,10 +97,10 @@ %perl_gen_filelist %clean -%{__rm} -rf $RPM_BUILD_ROOT +%{?buildroot:%__rm -rf "%{buildroot}"} %files -f %{name}.files %defattr(-,root,root,-) -%doc Changes README SIGNATURE +%doc Changes README %changelog ++++++ Path-Class-0.19.tar.bz2 -> Path-Class-0.22.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/Changes new/Path-Class-0.22/Changes --- old/Path-Class-0.19/Changes 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/Changes 2010-12-26 06:04:52.000000000 +0100 @@ -1,8 +1,21 @@ Revision history for Perl extension Path::Class. +0.22 - Sat Dec 25 22:59:20 CST 2010 + + - Added a basename() method for directory objects. [CLKAO, jloverso, + THEPLER, ZUMMO] + +0.21 - Tue Aug 17 19:13:13 CDT 2010 + + - Don't test the 'iomode' option under 5.6, because layers aren't + supported yet. + + - Fixes to spelling errors in the docmuentatino. [Ansgar Burchardt + and Debian patchers] + 0.19 - Sun Jun 6 20:50:27 CDT 2010 - - slurp() now accepts an 'iolayers' option to control how the file is + - slurp() now accepts an 'iomode' option to control how the file is opened. [Graham Barr] - In the openr() and openw() file methods, we now croak() instead of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/MANIFEST new/Path-Class-0.22/MANIFEST --- old/Path-Class-0.19/MANIFEST 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/MANIFEST 2010-12-26 06:04:52.000000000 +0100 @@ -13,4 +13,3 @@ t/02-foreign.t t/03-filesystem.t t/04-subclass.t -SIGNATURE Added here by Module::Build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/MANIFEST.SKIP new/Path-Class-0.22/MANIFEST.SKIP --- old/Path-Class-0.19/MANIFEST.SKIP 1970-01-01 01:00:00.000000000 +0100 +++ new/Path-Class-0.22/MANIFEST.SKIP 2010-12-26 06:04:52.000000000 +0100 @@ -0,0 +1,14 @@ +^MANIFEST. +^Makefile$ +^Build$ +^Makefile.old$ +^blib/ +^pm_to_blib$ +(^|/)\.svn +^\.cvsignore$ +^\.releaserc$ +^\.lwpcookies$ +^t/file-spec-tests$ +~$ +^Path-Class +^_build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/META.yml new/Path-Class-0.22/META.yml --- old/Path-Class-0.19/META.yml 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/META.yml 2010-12-26 06:04:52.000000000 +0100 @@ -1,6 +1,6 @@ --- name: Path-Class -version: 0.19 +version: 0.21 author: - 'Ken Williams, [email protected]' abstract: Cross-platform path specification manipulation @@ -27,16 +27,16 @@ provides: Path::Class: file: lib/Path/Class.pm - version: 0.19 + version: 0.21 Path::Class::Dir: file: lib/Path/Class/Dir.pm - version: 0.19 + version: 0.21 Path::Class::Entity: file: lib/Path/Class/Entity.pm - version: 0.19 + version: 0.21 Path::Class::File: file: lib/Path/Class/File.pm - version: 0.19 + version: 0.21 generated_by: Module::Build version 0.34 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/SIGNATURE new/Path-Class-0.22/SIGNATURE --- old/Path-Class-0.19/SIGNATURE 2010-06-07 03:53:34.000000000 +0200 +++ new/Path-Class-0.22/SIGNATURE 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -This file contains message digests of all files listed in MANIFEST, -signed via the Module::Signature module, version 0.55. - -To verify the content in this distribution, first make sure you have -Module::Signature installed, then type: - - % cpansign -v - -It will check each file's integrity, as well as the signature's -validity. If "==> Signature verified OK! <==" is not displayed, -the distribution may already have been compromised, and you should -not run its Makefile.PL or Build.PL. - ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -SHA1 3e94b50826015fe7ac1e769cadd656b53317d4ab Build.PL -SHA1 63cb36758d11d863e8e571b0f17350e513e73aaf Changes -SHA1 066a2dba8084a0c2a7e4b6996ad21872bc16beb5 INSTALL -SHA1 a0a13d88e63cfd5b6f8a6ce1d23838c407b747e0 MANIFEST -SHA1 00ee2bcb5f7534eeea92414289f947d1635b99f8 META.yml -SHA1 13ec5ef969c9758358bdd8b5cd6b71e7e9d775d9 Makefile.PL -SHA1 a7b1cdcddb8679dff993b475939abcfb73076afb README -SHA1 c080857efd0adb9512f786b55b3ccec24c44ba07 lib/Path/Class.pm -SHA1 52ac59589dbb2012e956a2c1b2a3b8e57f1bb009 lib/Path/Class/Dir.pm -SHA1 58f74f651664e537ad77f671222c15141e7aee13 lib/Path/Class/Entity.pm -SHA1 2fffcf838bfd4ce9685c05096abe957c6cfb2ad4 lib/Path/Class/File.pm -SHA1 97e2033418d3819f5ebf199d79bf7e87371bf164 t/01-basic.t -SHA1 a42f4b07e4c42e7a59b960b13c5466d7cd82e17a t/02-foreign.t -SHA1 24d2084a948436d73ce01e4f12db41c575d097bb t/03-filesystem.t -SHA1 a163d4cf70142b45974ed39c78571e7ce2ba5a7f t/04-subclass.t ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (Darwin) - -iD8DBQFMDFEegrvMBLfvlHYRAoqvAJ0VE8+5f75S4syeBSRQP92GugI2QACgg/vX -BIVv1OSNZnTOOA5GJiK2uR8= -=CjOC ------END PGP SIGNATURE----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/dist.ini new/Path-Class-0.22/dist.ini --- old/Path-Class-0.19/dist.ini 1970-01-01 01:00:00.000000000 +0100 +++ new/Path-Class-0.22/dist.ini 2010-12-26 06:04:52.000000000 +0100 @@ -0,0 +1,38 @@ +name = Path-Class +version = 0.22 +author = Ken Williams <[email protected]> +license = Perl_5 +copyright_holder = Ken Williams + +[GatherDir] + +[PkgVersion] +[PodVersion] + +[TestRelease] +[ConfirmRelease] +[UploadToCPAN] + +[Prereqs] +File::Spec = 0.87 +File::Spec::Mac = 1.3 +IO::Dir = 0 +IO::File = 0 +File::stat = 0 +File::Path = 0 +overload = 0 +Cwd = 0 + +; build_requires => { +; 'Test::More' => 0, +; 'File::Temp' => 0, +; }, +; create_makefile_pl => 'traditional', +; meta_merge => { +; resources => { +; repository => 'http://perl-path-class.googlecode.com/svn/trunk', +; homepage => 'http://code.google.com/p/perl-path-class', +; bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Path-Class', +; }, +; }, +; sign => 1, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/dist.ini~ new/Path-Class-0.22/dist.ini~ --- old/Path-Class-0.19/dist.ini~ 1970-01-01 01:00:00.000000000 +0100 +++ new/Path-Class-0.22/dist.ini~ 2010-12-26 06:04:52.000000000 +0100 @@ -0,0 +1,52 @@ +name = Path-Class +version = 0.21 +author = Ken Williams <[email protected]> +license = Perl_5 +copyright_holder = Ken Williams + +[GatherDir] +[MetaYAML] +[MakeMaker] +[Manifest] + +[Prereqs] +Carp = 0 +List::MoreUtils = 0.09 +Sub::Exporter = 0.90 +UDCode = 0 + +------- + +use Module::Build; + +my $b = Module::Build->new + ( + module_name => 'Path::Class', + license => 'perl', + requires => { + 'File::Spec' => 0.87, + 'File::Spec::Mac' => 1.3, + 'IO::Dir' => 0, + 'IO::File' => 0, + 'File::stat' => 0, + 'File::Path' => 0, + 'overload' => 0, + 'Cwd' => 0, + }, + build_requires => { + 'Test::More' => 0, + 'File::Temp' => 0, + }, + create_makefile_pl => 'traditional', + create_readme => 1, + meta_merge => { + resources => { + repository => 'http://perl-path-class.googlecode.com/svn/trunk', + homepage => 'http://code.google.com/p/perl-path-class', + bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Path-Class', + }, + }, + sign => 1, + ); + +$b->create_build_script; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/lib/Path/Class/Dir.pm new/Path-Class-0.22/lib/Path/Class/Dir.pm --- old/Path-Class-0.19/lib/Path/Class/Dir.pm 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/lib/Path/Class/Dir.pm 2010-12-26 06:04:52.000000000 +0100 @@ -1,6 +1,7 @@ package Path::Class::Dir; - -$VERSION = '0.19'; +BEGIN { + $Path::Class::Dir::VERSION = '0.22'; +} use strict; use Path::Class::File; @@ -71,6 +72,8 @@ return $_[0]->file_class->new(@_); } +sub basename { shift()->{dirs}[-1] } + sub dir_list { my $self = shift; my $d = $self->{dirs}; @@ -258,6 +261,10 @@ Path::Class::Dir - Objects representing directories +=head1 VERSION + +version 0.22 + =head1 SYNOPSIS use Path::Class qw(dir); # Export a short constructor @@ -638,7 +645,7 @@ Returns the class which should be used to create file objects. -Generally overriden whenever this class is subclassed. +Generally overridden whenever this class is subclassed. =back @@ -650,4 +657,4 @@ Path::Class, Path::Class::File, File::Spec -=cut +=cut \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/lib/Path/Class/Entity.pm new/Path-Class-0.22/lib/Path/Class/Entity.pm --- old/Path-Class-0.19/lib/Path/Class/Entity.pm 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/lib/Path/Class/Entity.pm 2010-12-26 06:04:52.000000000 +0100 @@ -1,6 +1,7 @@ package Path::Class::Entity; - -$VERSION = '0.19'; +BEGIN { + $Path::Class::Entity::VERSION = '0.22'; +} use strict; use File::Spec; @@ -84,3 +85,27 @@ sub lstat { File::stat::lstat("$_[0]") } 1; +__END__ + +=head1 NAME + +Path::Class:Entity - Base class for files and directories + +=head1 VERSION + +version 0.22 + +=head1 DESCRIPTION + +This class is the base class for C<Path::Class::File> and +C<Path::Class::Dir>, it is not used directly by callers. + +=head1 AUTHOR + +Ken Williams, [email protected] + +=head1 SEE ALSO + +Path::Class + +=cut \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/lib/Path/Class/File.pm new/Path-Class-0.22/lib/Path/Class/File.pm --- old/Path-Class-0.19/lib/Path/Class/File.pm 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/lib/Path/Class/File.pm 2010-12-26 06:04:52.000000000 +0100 @@ -1,6 +1,7 @@ package Path::Class::File; - -$VERSION = '0.19'; +BEGIN { + $Path::Class::File::VERSION = '0.22'; +} use strict; use Path::Class::Dir; @@ -100,6 +101,10 @@ Path::Class::File - Objects representing files +=head1 VERSION + +version 0.22 + =head1 SYNOPSIS use Path::Class qw(file); # Export a short constructor @@ -299,7 +304,7 @@ my @lines = $file->slurp(chomp => 1); -You may also use the C<iomode> paramter to pass in an IO mode to use +You may also use the C<iomode> parameter to pass in an IO mode to use when opening the file, usually IO layers (though anything accepted by the MODE argument of C<open()> is accepted here). Just make sure it's a I<reading> mode. @@ -334,7 +339,7 @@ Returns the class which should be used to create directory objects. -Generally overriden whenever this class is subclassed. +Generally overridden whenever this class is subclassed. =back @@ -346,4 +351,4 @@ Path::Class, Path::Class::Dir, File::Spec -=cut +=cut \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/lib/Path/Class.pm new/Path-Class-0.22/lib/Path/Class.pm --- old/Path-Class-0.19/lib/Path/Class.pm 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/lib/Path/Class.pm 2010-12-26 06:04:52.000000000 +0100 @@ -1,6 +1,8 @@ package Path::Class; +BEGIN { + $Path::Class::VERSION = '0.22'; +} -$VERSION = '0.19'; @ISA = qw(Exporter); @EXPORT = qw(file dir); @EXPORT_OK = qw(file dir foreign_file foreign_dir); @@ -23,6 +25,10 @@ Path::Class - Cross-platform path specification manipulation +=head1 VERSION + +version 0.22 + =head1 SYNOPSIS use Path::Class; @@ -174,4 +180,4 @@ Path::Class::Dir, Path::Class::File, File::Spec -=cut +=cut \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/t/01-basic.t new/Path-Class-0.22/t/01-basic.t --- old/Path-Class-0.19/t/01-basic.t 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/t/01-basic.t 2010-12-26 06:04:52.000000000 +0100 @@ -7,7 +7,7 @@ use Path::Class; use Cwd; -plan tests => 66; +plan tests => 68; ok(1); my $file1 = Path::Class::File->new('foo.txt'); @@ -25,6 +25,7 @@ my $dir = dir('tmp'); ok $dir, 'tmp'; ok $dir->is_absolute, ''; +ok $dir->basename, 'tmp'; my $dir2 = dir('/tmp'); ok $dir2, '/tmp'; @@ -47,6 +48,7 @@ $cat = $dir2->subdir('foo'); ok $cat, '/tmp/foo'; ok $cat->isa('Path::Class::Dir'); +ok $cat->basename, 'foo'; my $file = file('/foo//baz/./foo')->cleanup; ok $file, '/foo/baz/foo'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/t/01-basic.t~ new/Path-Class-0.22/t/01-basic.t~ --- old/Path-Class-0.19/t/01-basic.t~ 1970-01-01 01:00:00.000000000 +0100 +++ new/Path-Class-0.22/t/01-basic.t~ 2010-12-26 06:04:52.000000000 +0100 @@ -0,0 +1,147 @@ +BEGIN { + $^O = 'Unix'; # Test in Unix mode +} + +use Test; +use strict; +use Path::Class; +use Cwd; + +plan tests => 65; +ok(1); + +my $file1 = Path::Class::File->new('foo.txt'); +ok $file1, 'foo.txt'; +ok $file1->is_absolute, ''; +ok $file1->dir, '.'; +ok $file1->basename, 'foo.txt'; + +my $file2 = file('dir', 'bar.txt'); +ok $file2, 'dir/bar.txt'; +ok $file2->is_absolute, ''; +ok $file2->dir, 'dir'; +ok $file2->basename, 'bar.txt'; + +my $dir = dir('tmp'); +ok $dir, 'tmp'; +ok $dir->is_absolute, ''; + +my $dir2 = dir('/tmp'); +ok $dir2, '/tmp'; +ok $dir2->is_absolute, 1; + +my $cat = file($dir, 'foo'); +ok $cat, 'tmp/foo'; +$cat = $dir->file('foo'); +ok $cat, 'tmp/foo'; +ok $cat->dir, 'tmp'; +ok $cat->basename, 'foo'; + +$cat = file($dir2, 'foo'); +ok $cat, '/tmp/foo'; +$cat = $dir2->file('foo'); +ok $cat, '/tmp/foo'; +ok $cat->isa('Path::Class::File'); +ok $cat->dir, '/tmp'; + +$cat = $dir2->subdir('foo'); +ok $cat, '/tmp/foo'; +ok $cat->isa('Path::Class::Dir'); + +my $file = file('/foo//baz/./foo')->cleanup; +ok $file, '/foo/baz/foo'; +ok $file->dir, '/foo/baz'; +ok $file->parent, '/foo/baz'; + +{ + my $dir = dir('/foo/bar/baz'); + ok $dir->parent, '/foo/bar'; + ok $dir->parent->parent, '/foo'; + ok $dir->parent->parent->parent, '/'; + ok $dir->parent->parent->parent->parent, '/'; + + $dir = dir('foo/bar/baz'); + ok $dir->parent, 'foo/bar'; + ok $dir->parent->parent, 'foo'; + ok $dir->parent->parent->parent, '.'; + ok $dir->parent->parent->parent->parent, '..'; + ok $dir->parent->parent->parent->parent->parent, '../..'; +} + +{ + my $dir = dir("foo/"); + ok $dir, 'foo'; + ok $dir->parent, '.'; +} + +{ + # Special cases + ok dir(''), '/'; + ok dir(), '.'; + ok dir('', 'var', 'tmp'), '/var/tmp'; + ok dir()->absolute, dir(Cwd::cwd())->cleanup; +} + +{ + my $file = file('/tmp/foo/bar.txt'); + ok $file->relative('/tmp'), 'foo/bar.txt'; + ok $file->relative('/tmp/foo'), 'bar.txt'; + ok $file->relative('/tmp/'), 'foo/bar.txt'; + ok $file->relative('/tmp/foo/'), 'bar.txt'; + + $file = file('one/two/three'); + ok $file->relative('one'), 'two/three'; +} + +{ + # Try out the dir_list() method + my $dir = dir('one/two/three/four/five'); + my @d = $dir->dir_list(); + ok "@d", "one two three four five"; + + @d = $dir->dir_list(2); + ok "@d", "three four five"; + + @d = $dir->dir_list(-2); + ok "@d", "four five"; + + @d = $dir->dir_list(2, 2); + ok "@d", "three four", "dir_list(2, 2)"; + + @d = $dir->dir_list(-3, 2); + ok "@d", "three four", "dir_list(-3, 2)"; + + @d = $dir->dir_list(-3, -2); + ok "@d", "three", "dir_list(-3, -2)"; + + @d = $dir->dir_list(-3, -1); + ok "@d", "three four", "dir_list(-3, -1)"; + + my $d = $dir->dir_list(); + ok $d, 5, "scalar dir_list()"; + + $d = $dir->dir_list(2); + ok $d, "three", "scalar dir_list(2)"; + + $d = $dir->dir_list(-2); + ok $d, "four", "scalar dir_list(-2)"; + + $d = $dir->dir_list(2, 2); + ok $d, "four", "scalar dir_list(2, 2)"; +} + +{ + # Test is_dir() + ok dir('foo')->is_dir, 1; + ok file('foo')->is_dir, 0; +} + +{ + # subsumes() + ok dir('foo/bar')->subsumes('foo/bar/baz'), 1; + ok dir('/foo/bar')->subsumes('/foo/bar/baz'), 1; + ok dir('foo/bar')->subsumes('bar/baz'), 0; + ok dir('/foo/bar')->subsumes('foo/bar'), 0; + ok dir('/foo/bar')->subsumes('/foo/baz'), 0; + ok dir('/')->subsumes('/foo/bar'), 1; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/t/02-foreign.t~ new/Path-Class-0.22/t/02-foreign.t~ --- old/Path-Class-0.19/t/02-foreign.t~ 1970-01-01 01:00:00.000000000 +0100 +++ new/Path-Class-0.22/t/02-foreign.t~ 2010-12-26 06:04:52.000000000 +0100 @@ -0,0 +1,75 @@ +use Test; +use strict; +BEGIN { plan tests => 30, todo => [29,30] }; +use Path::Class qw(file dir foreign_file foreign_dir); +ok(1); + + +my $file = Path::Class::File->new_foreign('Unix', 'dir', 'foo.txt'); +ok $file, 'dir/foo.txt'; + +ok $file->as_foreign('Win32'), 'dir\foo.txt'; +ok $file->as_foreign('Mac'), ':dir:foo.txt'; +ok $file->as_foreign('OS2'), 'dir/foo.txt'; + +if ($^O eq 'VMS') { + ok $file->as_foreign('VMS'), '[.dir]foo.txt'; +} else { + skip "skip Can't test VMS code on other platforms", 1; +} + +$file = foreign_file('Mac', ':dir:foo.txt'); +ok $file, ':dir:foo.txt'; +ok $file->as_foreign('Unix'), 'dir/foo.txt'; +ok $file->dir, ':dir:'; + + +my $dir = Path::Class::Dir->new_foreign('Unix', 'dir/subdir'); +ok $dir, 'dir/subdir'; +ok $dir->as_foreign('Win32'), 'dir\subdir'; +ok $dir->as_foreign('Mac'), ':dir:subdir:'; +ok $dir->as_foreign('OS2'), 'dir/subdir'; + +if ($^O eq 'VMS') { + ok $dir->as_foreign('VMS'), '[.dir.subdir]'; +} else { + skip "skip Can't test VMS code on other platforms", 1; +} + +{ + # subsumes() should respect foreignness + my ($me, $other) = map { Path::Class::Dir->new_foreign('Unix', $_) } qw(/ /Foo); + ok($me->subsumes($other)); + + ($me, $other) = map { Path::Class::Dir->new_foreign('Win32', $_) } qw(C:\ C:\Foo); + ok($me->subsumes($other)); +} + +# Note that "\\" and '\\' are each a single backslash +$dir = foreign_dir('Win32', 'C:\\'); +ok $dir, 'C:\\'; +$dir = foreign_dir('Win32', 'C:/'); +ok $dir, 'C:\\'; +ok $dir->subdir('Program Files'), 'C:\\Program Files'; + +$dir = foreign_dir('Mac', ':dir:subdir:'); +ok $dir, ':dir:subdir:'; +ok $dir->subdir('foo'), ':dir:subdir:foo:'; +ok $dir->file('foo.txt'), ':dir:subdir:foo.txt'; +ok $dir->parent, ':dir:'; +ok $dir->is_relative, 1; + +$dir = foreign_dir('Mac', ':dir::dir2:subdir'); +ok $dir, ':dir::dir2:subdir:'; +ok $dir->as_foreign('Unix'), 'dir/../dir2/subdir'; + +$dir = foreign_dir('Mac', 'Volume:dir:subdir:'); +unshift @{$dir->{dirs}}, ''; +ok $dir, 'Volume:dir:subdir:'; +ok $dir->is_absolute; +#push +warn "Dir: @{$dir->{dirs}}\n"; +#my $dir2 = foreign_dir('Mac', ':dir:subdir:'); warn "Dir2: @{$dir2->{dirs}}\n"; +ok $dir->as_foreign('Unix'), '/dir/subdir'; +ok $dir->as_foreign('Unix')->is_absolute, 1; + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/t/03-filesystem.t new/Path-Class-0.22/t/03-filesystem.t --- old/Path-Class-0.19/t/03-filesystem.t 2010-06-07 03:53:30.000000000 +0200 +++ new/Path-Class-0.22/t/03-filesystem.t 2010-12-26 06:04:52.000000000 +0100 @@ -147,9 +147,12 @@ ok not -e $file; } -{ +SKIP: { my $file = file('t', 'slurp'); ok $file; + + skip "IO modes not available until perl 5.7.1", 5 + unless $^V ge v5.7.1; my $fh = $file->open('>:raw') or die "Can't create $file: $!"; print $fh "Line1\r\nLine2\r\n\302\261\r\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/t/03-filesystem.t~ new/Path-Class-0.22/t/03-filesystem.t~ --- old/Path-Class-0.19/t/03-filesystem.t~ 1970-01-01 01:00:00.000000000 +0100 +++ new/Path-Class-0.22/t/03-filesystem.t~ 2010-12-26 06:04:52.000000000 +0100 @@ -0,0 +1,252 @@ + +use strict; +use Test::More; +use Path::Class; + +plan tests => 73; +ok 1; + +my $file = file('t', 'testfile'); +ok $file; + +{ + my $fh = $file->open('w'); + ok $fh; + + ok print $fh "Foo\n"; +} + +ok -e $file; + +{ + my $fh = $file->open; + is scalar <$fh>, "Foo\n"; +} + +{ + my $stat = $file->stat; + ok $stat; + cmp_ok $stat->mtime, '>', time() - 20; # Modified within last 20 seconds + + $stat = $file->dir->stat; + ok $stat; +} + +1 while unlink $file; +ok not -e $file; + + +my $dir = dir('t', 'testdir'); +ok $dir; + +ok mkdir($dir, 0777); +ok -d $dir; + +$file = $dir->file('foo.x'); +$file->touch; +ok -e $file; + +{ + my $dh = $dir->open; + ok $dh; + + my @files = readdir $dh; + is scalar @files, 3; + ok scalar grep { $_ eq 'foo.x' } @files; +} + +ok $dir->rmtree; +ok !-e $dir; + +{ + $dir = dir('t', 'foo', 'bar'); + ok $dir->mkpath; + ok -d $dir; + + # Use a Unix sample path to test cleaning it up + my $ugly = Path::Class::Dir->new_foreign(Unix => 't/foo/..//foo/bar'); + $ugly->resolve; + is $ugly->as_foreign('Unix'), 't/foo/bar'; + + $dir = $dir->parent; + ok $dir->rmtree; + ok !-e $dir; +} + +{ + $dir = dir('t', 'foo'); + ok $dir->mkpath; + ok $dir->subdir('dir')->mkpath; + ok -d $dir->subdir('dir'); + + ok $dir->file('file.x')->touch; + ok $dir->file('0')->touch; + my @contents; + while (my $file = $dir->next) { + push @contents, $file; + } + is scalar @contents, 5; + + my $joined = join ' ', sort map $_->basename, grep {-f $_} @contents; + is $joined, '0 file.x'; + + my ($subdir) = grep {$_ eq $dir->subdir('dir')} @contents; + ok $subdir; + is -d $subdir, 1; + + my ($file) = grep {$_ eq $dir->file('file.x')} @contents; + ok $file; + is -d $file, ''; + + ok $dir->rmtree; + ok !-e $dir; + + + # Try again with directory called '0', in curdir + my $orig = dir()->absolute; + + ok $dir->mkpath; + ok chdir($dir); + my $dir2 = dir(); + ok $dir2->subdir('0')->mkpath; + ok -d $dir2->subdir('0'); + + @contents = (); + while (my $file = $dir2->next) { + push @contents, $file; + } + ok grep {$_ eq '0'} @contents; + + ok chdir($orig); + ok $dir->rmtree; + ok !-e $dir; +} + +{ + my $file = file('t', 'slurp'); + ok $file; + + my $fh = $file->open('w') or die "Can't create $file: $!"; + print $fh "Line1\nLine2\n"; + close $fh; + ok -e $file; + + my $content = $file->slurp; + is $content, "Line1\nLine2\n"; + + my @content = $file->slurp; + is_deeply \@content, ["Line1\n", "Line2\n"]; + + @content = $file->slurp(chomp => 1); + is_deeply \@content, ["Line1", "Line2"]; + + $file->remove; + ok not -e $file; +} + +{ + # Make sure we can make an absolute/relative roundtrip + my $cwd = dir(); + is $cwd, $cwd->absolute->relative, "from $cwd to ".$cwd->absolute." to ".$cwd->absolute->relative; +} + +{ + my $t = dir('t'); + my $foo_bar = $t->subdir('foo','bar'); + $foo_bar->rmtree; # Make sure it doesn't exist + + ok $t->subsumes($foo_bar), "t subsumes t/foo/bar"; + ok !$t->contains($foo_bar), "t doesn't contain t/foo/bar"; + + $foo_bar->mkpath; + ok $t->subsumes($foo_bar), "t still subsumes t/foo/bar"; + ok $t->contains($foo_bar), "t now contains t/foo/bar"; + + $t->subdir('foo')->rmtree; +} + +{ + # Test recursive iteration through the following structure: + # a + # / \ + # b c + # / \ \ + # d e f + # / \ \ + # g h i + (my $abe = dir(qw(a b e)))->mkpath; + (my $acf = dir(qw(a c f)))->mkpath; + file($acf, 'i')->touch; + file($abe, 'h')->touch; + file($abe, 'g')->touch; + file('a', 'b', 'd')->touch; + + my $a = dir('a'); + + # Make sure the children() method works ok + my @children = sort map $_->as_foreign('Unix'), $a->children; + is_deeply \@children, ['a/b', 'a/c']; + + { + recurse_test( $a, + preorder => 1, depthfirst => 0, # The default + precedence => [qw(a a/b + a a/c + a/b a/b/e/h + a/b a/c/f/i + a/c a/b/e/h + a/c a/c/f/i + )], + ); + } + + { + my $files = + recurse_test( $a, + preorder => 1, depthfirst => 1, + precedence => [qw(a a/b + a a/c + a/b a/b/e/h + a/c a/c/f/i + )], + ); + is_depthfirst($files); + } + + { + my $files = + recurse_test( $a, + preorder => 0, depthfirst => 1, + precedence => [qw(a/b a + a/c a + a/b/e/h a/b + a/c/f/i a/c + )], + ); + is_depthfirst($files); + } + + + $a->rmtree; + + sub is_depthfirst { + my $files = shift; + if ($files->{'a/b'} < $files->{'a/c'}) { + cmp_ok $files->{'a/b/e'}, '<', $files->{'a/c'}, "Ensure depth-first search"; + } else { + cmp_ok $files->{'a/c/f'}, '<', $files->{'a/b'}, "Ensure depth-first search"; + } + } + + sub recurse_test { + my ($dir, %args) = @_; + my $precedence = delete $args{precedence}; + my ($i, %files) = (0); + $a->recurse( callback => sub {$files{shift->as_foreign('Unix')->stringify} = ++$i}, + %args ); + while (my ($pre, $post) = splice @$precedence, 0, 2) { + cmp_ok $files{$pre}, '<', $files{$post}, "$pre should come before $post"; + } + return \%files; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.19/t/file-spec-tests new/Path-Class-0.22/t/file-spec-tests --- old/Path-Class-0.19/t/file-spec-tests 1970-01-01 01:00:00.000000000 +0100 +++ new/Path-Class-0.22/t/file-spec-tests 2010-12-26 06:04:52.000000000 +0100 @@ -0,0 +1,379 @@ +#!./perl + +BEGIN { + $^O = ''; +#chdir 't' if -d 't'; +#unshift @INC, '../lib'; +} + +# Each element in this array is a single test. Storing them this way makes +# maintenance easy, and should be OK since perl should be pretty functional +# before these tests are run. + +@tests = ( +# Function Expected +[ "Unix->catfile('a','b','c')", 'a/b/c' ], + +[ "Unix->splitpath('file')", ',,file' ], +[ "Unix->splitpath('/d1/d2/d3/')", ',/d1/d2/d3/,' ], +[ "Unix->splitpath('d1/d2/d3/')", ',d1/d2/d3/,' ], +[ "Unix->splitpath('/d1/d2/d3/.')", ',/d1/d2/d3/.,' ], +[ "Unix->splitpath('/d1/d2/d3/..')", ',/d1/d2/d3/..,' ], +[ "Unix->splitpath('/d1/d2/d3/.file')", ',/d1/d2/d3/,.file' ], +[ "Unix->splitpath('d1/d2/d3/file')", ',d1/d2/d3/,file' ], +[ "Unix->splitpath('/../../d1/')", ',/../../d1/,' ], +[ "Unix->splitpath('/././d1/')", ',/././d1/,' ], + +[ "Unix->catpath('','','file')", 'file' ], +[ "Unix->catpath('','/d1/d2/d3/','')", '/d1/d2/d3/' ], +[ "Unix->catpath('','d1/d2/d3/','')", 'd1/d2/d3/' ], +[ "Unix->catpath('','/d1/d2/d3/.','')", '/d1/d2/d3/.' ], +[ "Unix->catpath('','/d1/d2/d3/..','')", '/d1/d2/d3/..' ], +[ "Unix->catpath('','/d1/d2/d3/','.file')", '/d1/d2/d3/.file' ], +[ "Unix->catpath('','d1/d2/d3/','file')", 'd1/d2/d3/file' ], +[ "Unix->catpath('','/../../d1/','')", '/../../d1/' ], +[ "Unix->catpath('','/././d1/','')", '/././d1/' ], +[ "Unix->catpath('d1','d2/d3/','')", 'd2/d3/' ], +[ "Unix->catpath('d1','d2','d3/')", 'd2/d3/' ], + +[ "Unix->splitdir('')", '' ], +[ "Unix->splitdir('/d1/d2/d3/')", ',d1,d2,d3,' ], +[ "Unix->splitdir('d1/d2/d3/')", 'd1,d2,d3,' ], +[ "Unix->splitdir('/d1/d2/d3')", ',d1,d2,d3' ], +[ "Unix->splitdir('d1/d2/d3')", 'd1,d2,d3' ], + +[ "Unix->catdir()", '' ], +[ "Unix->catdir('/')", '/' ], +[ "Unix->catdir('','d1','d2','d3','')", '/d1/d2/d3' ], +[ "Unix->catdir('d1','d2','d3','')", 'd1/d2/d3' ], +[ "Unix->catdir('','d1','d2','d3')", '/d1/d2/d3' ], +[ "Unix->catdir('d1','d2','d3')", 'd1/d2/d3' ], + +[ "Unix->catfile('a','b','c')", 'a/b/c' ], + +[ "Unix->canonpath('')", '' ], +[ "Unix->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c' ], +[ "Unix->canonpath('/.')", '/.' ], + +[ "Unix->abs2rel('/t1/t2/t3','/t1/t2/t3')", '' ], +[ "Unix->abs2rel('/t1/t2/t4','/t1/t2/t3')", '../t4' ], +[ "Unix->abs2rel('/t1/t2','/t1/t2/t3')", '..' ], +[ "Unix->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')", 't4' ], +[ "Unix->abs2rel('/t4/t5/t6','/t1/t2/t3')", '../../../t4/t5/t6' ], +#[ "Unix->abs2rel('../t4','/t1/t2/t3')", '../t4' ], +[ "Unix->abs2rel('/','/t1/t2/t3')", '../../..' ], +[ "Unix->abs2rel('///','/t1/t2/t3')", '../../..' ], +[ "Unix->abs2rel('/.','/t1/t2/t3')", '../../../.' ], +[ "Unix->abs2rel('/./','/t1/t2/t3')", '../../..' ], +#[ "Unix->abs2rel('../t4','/t1/t2/t3')", '../t4' ], + +[ "Unix->rel2abs('t4','/t1/t2/t3')", '/t1/t2/t3/t4' ], +[ "Unix->rel2abs('t4/t5','/t1/t2/t3')", '/t1/t2/t3/t4/t5' ], +[ "Unix->rel2abs('.','/t1/t2/t3')", '/t1/t2/t3' ], +[ "Unix->rel2abs('..','/t1/t2/t3')", '/t1/t2/t3/..' ], +[ "Unix->rel2abs('../t4','/t1/t2/t3')", '/t1/t2/t3/../t4' ], +[ "Unix->rel2abs('/t1','/t1/t2/t3')", '/t1' ], + +[ "Win32->splitpath('file')", ',,file' ], +[ "Win32->splitpath('\\d1/d2\\d3/')", ',\\d1/d2\\d3/,' ], +[ "Win32->splitpath('d1/d2\\d3/')", ',d1/d2\\d3/,' ], +[ "Win32->splitpath('\\d1/d2\\d3/.')", ',\\d1/d2\\d3/.,' ], +[ "Win32->splitpath('\\d1/d2\\d3/..')", ',\\d1/d2\\d3/..,' ], +[ "Win32->splitpath('\\d1/d2\\d3/.file')", ',\\d1/d2\\d3/,.file' ], +[ "Win32->splitpath('\\d1/d2\\d3/file')", ',\\d1/d2\\d3/,file' ], +[ "Win32->splitpath('d1/d2\\d3/file')", ',d1/d2\\d3/,file' ], +[ "Win32->splitpath('C:\\d1/d2\\d3/')", 'C:,\\d1/d2\\d3/,' ], +[ "Win32->splitpath('C:d1/d2\\d3/')", 'C:,d1/d2\\d3/,' ], +[ "Win32->splitpath('C:\\d1/d2\\d3/file')", 'C:,\\d1/d2\\d3/,file' ], +[ "Win32->splitpath('C:d1/d2\\d3/file')", 'C:,d1/d2\\d3/,file' ], +[ "Win32->splitpath('C:\\../d2\\d3/file')", 'C:,\\../d2\\d3/,file' ], +[ "Win32->splitpath('C:../d2\\d3/file')", 'C:,../d2\\d3/,file' ], +[ "Win32->splitpath('\\../..\\d1/')", ',\\../..\\d1/,' ], +[ "Win32->splitpath('\\./.\\d1/')", ',\\./.\\d1/,' ], +[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/')", '\\\\node\\share,\\d1/d2\\d3/,' ], +[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/file')", '\\\\node\\share,\\d1/d2\\d3/,file' ], +[ "Win32->splitpath('\\\\node\\share\\d1/d2\\file')", '\\\\node\\share,\\d1/d2\\,file' ], +[ "Win32->splitpath('file',1)", ',file,' ], +[ "Win32->splitpath('\\d1/d2\\d3/',1)", ',\\d1/d2\\d3/,' ], +[ "Win32->splitpath('d1/d2\\d3/',1)", ',d1/d2\\d3/,' ], +[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/',1)", '\\\\node\\share,\\d1/d2\\d3/,' ], + +[ "Win32->catpath('','','file')", 'file' ], +[ "Win32->catpath('','\\d1/d2\\d3/','')", '\\d1/d2\\d3/' ], +[ "Win32->catpath('','d1/d2\\d3/','')", 'd1/d2\\d3/' ], +[ "Win32->catpath('','\\d1/d2\\d3/.','')", '\\d1/d2\\d3/.' ], +[ "Win32->catpath('','\\d1/d2\\d3/..','')", '\\d1/d2\\d3/..' ], +[ "Win32->catpath('','\\d1/d2\\d3/','.file')", '\\d1/d2\\d3/.file' ], +[ "Win32->catpath('','\\d1/d2\\d3/','file')", '\\d1/d2\\d3/file' ], +[ "Win32->catpath('','d1/d2\\d3/','file')", 'd1/d2\\d3/file' ], +[ "Win32->catpath('C:','\\d1/d2\\d3/','')", 'C:\\d1/d2\\d3/' ], +[ "Win32->catpath('C:','d1/d2\\d3/','')", 'C:d1/d2\\d3/' ], +[ "Win32->catpath('C:','\\d1/d2\\d3/','file')", 'C:\\d1/d2\\d3/file' ], +[ "Win32->catpath('C:','d1/d2\\d3/','file')", 'C:d1/d2\\d3/file' ], +[ "Win32->catpath('C:','\\../d2\\d3/','file')", 'C:\\../d2\\d3/file' ], +[ "Win32->catpath('C:','../d2\\d3/','file')", 'C:../d2\\d3/file' ], +[ "Win32->catpath('','\\../..\\d1/','')", '\\../..\\d1/' ], +[ "Win32->catpath('','\\./.\\d1/','')", '\\./.\\d1/' ], +[ "Win32->catpath('\\\\node\\share','\\d1/d2\\d3/','')", '\\\\node\\share\\d1/d2\\d3/' ], +[ "Win32->catpath('\\\\node\\share','\\d1/d2\\d3/','file')", '\\\\node\\share\\d1/d2\\d3/file' ], +[ "Win32->catpath('\\\\node\\share','\\d1/d2\\','file')", '\\\\node\\share\\d1/d2\\file' ], + +[ "Win32->splitdir('')", '' ], +[ "Win32->splitdir('\\d1/d2\\d3/')", ',d1,d2,d3,' ], +[ "Win32->splitdir('d1/d2\\d3/')", 'd1,d2,d3,' ], +[ "Win32->splitdir('\\d1/d2\\d3')", ',d1,d2,d3' ], +[ "Win32->splitdir('d1/d2\\d3')", 'd1,d2,d3' ], + +[ "Win32->catdir()", '' ], +[ "Win32->catdir('')", '\\' ], +[ "Win32->catdir('/')", '\\' ], +[ "Win32->catdir('//d1','d2')", '\\\\d1\\d2' ], +[ "Win32->catdir('','/d1','d2')", '\\\\d1\\d2' ], +[ "Win32->catdir('','','/d1','d2')", '\\\\\\d1\\d2' ], +[ "Win32->catdir('','//d1','d2')", '\\\\\\d1\\d2' ], +[ "Win32->catdir('','','//d1','d2')", '\\\\\\\\d1\\d2' ], +[ "Win32->catdir('','d1','','d2','')", '\\d1\\d2' ], +[ "Win32->catdir('','d1','d2','d3','')", '\\d1\\d2\\d3' ], +[ "Win32->catdir('d1','d2','d3','')", 'd1\\d2\\d3' ], +[ "Win32->catdir('','d1','d2','d3')", '\\d1\\d2\\d3' ], +[ "Win32->catdir('d1','d2','d3')", 'd1\\d2\\d3' ], +[ "Win32->catdir('A:/d1','d2','d3')", 'A:\\d1\\d2\\d3' ], +[ "Win32->catdir('A:/d1','d2','d3','')", 'A:\\d1\\d2\\d3' ], +#[ "Win32->catdir('A:/d1','B:/d2','d3','')", 'A:\\d1\\d2\\d3' ], +[ "Win32->catdir('A:/d1','B:/d2','d3','')", 'A:\\d1\\B:\\d2\\d3' ], +[ "Win32->catdir('A:/')", 'A:\\' ], + +[ "Win32->catfile('a','b','c')", 'a\\b\\c' ], + +[ "Win32->canonpath('')", '' ], +[ "Win32->canonpath('a:')", 'A:' ], +[ "Win32->canonpath('A:f')", 'A:f' ], +[ "Win32->canonpath('//a\\b//c')", '\\\\a\\b\\c' ], +[ "Win32->canonpath('/a/..../c')", '\\a\\....\\c' ], +[ "Win32->canonpath('//a/b\\c')", '\\\\a\\b\\c' ], +[ "Win32->canonpath('////')", '\\\\\\' ], +[ "Win32->canonpath('//')", '\\' ], +[ "Win32->canonpath('/.')", '\\.' ], +[ "Win32->canonpath('//a/b/../../c')", '\\\\a\\b\\..\\..\\c' ], +[ "Win32->canonpath('//a/../../c')", '\\\\a\\..\\..\\c' ], + +[ "Win32->abs2rel('/t1/t2/t3','/t1/t2/t3')", '' ], +[ "Win32->abs2rel('/t1/t2/t4','/t1/t2/t3')", '..\\t4' ], +[ "Win32->abs2rel('/t1/t2','/t1/t2/t3')", '..' ], +[ "Win32->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')", 't4' ], +[ "Win32->abs2rel('/t4/t5/t6','/t1/t2/t3')", '..\\..\\..\\t4\\t5\\t6' ], +#[ "Win32->abs2rel('../t4','/t1/t2/t3')", '\\t1\\t2\\t3\\..\\t4' ], +[ "Win32->abs2rel('/','/t1/t2/t3')", '..\\..\\..' ], +[ "Win32->abs2rel('///','/t1/t2/t3')", '..\\..\\..' ], +[ "Win32->abs2rel('/.','/t1/t2/t3')", '..\\..\\..\\.' ], +[ "Win32->abs2rel('/./','/t1/t2/t3')", '..\\..\\..' ], +[ "Win32->abs2rel('\\\\a/t1/t2/t4','/t2/t3')", '..\\t4' ], +[ "Win32->abs2rel('//a/t1/t2/t4','/t2/t3')", '..\\t4' ], + +[ "Win32->rel2abs('temp','C:/')", 'C:\\temp' ], +[ "Win32->rel2abs('temp','C:/a')", 'C:\\a\\temp' ], +[ "Win32->rel2abs('temp','C:/a/')", 'C:\\a\\temp' ], +[ "Win32->rel2abs('../','C:/')", 'C:\\..' ], +[ "Win32->rel2abs('../','C:/a')", 'C:\\a\\..' ], +[ "Win32->rel2abs('temp','//prague_main/work/')", '\\\\prague_main\\work\\temp' ], +[ "Win32->rel2abs('../temp','//prague_main/work/')", '\\\\prague_main\\work\\..\\temp' ], +[ "Win32->rel2abs('temp','//prague_main/work')", '\\\\prague_main\\work\\temp' ], +[ "Win32->rel2abs('../','//prague_main/work')", '\\\\prague_main\\work\\..' ], + +[ "VMS->splitpath('file')", ',,file' ], +[ "VMS->splitpath('[d1.d2.d3]')", ',[d1.d2.d3],' ], +[ "VMS->splitpath('[.d1.d2.d3]')", ',[.d1.d2.d3],' ], +[ "VMS->splitpath('[d1.d2.d3]file')", ',[d1.d2.d3],file' ], +[ "VMS->splitpath('d1/d2/d3/file')", ',[.d1.d2.d3],file' ], +[ "VMS->splitpath('/d1/d2/d3/file')", 'd1:,[d2.d3],file' ], +[ "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->catpath('','','file')", 'file' ], +[ "VMS->catpath('','[d1.d2.d3]','')", '[d1.d2.d3]' ], +[ "VMS->catpath('','[.d1.d2.d3]','')", '[.d1.d2.d3]' ], +[ "VMS->catpath('','[d1.d2.d3]','file')", '[d1.d2.d3]file' ], +[ "VMS->catpath('','[.d1.d2.d3]','file')", '[.d1.d2.d3]file' ], +[ "VMS->catpath('','d1/d2/d3','file')", '[.d1.d2.d3]file' ], +[ "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->canonpath('')", '' ], +[ "VMS->canonpath('volume:[d1]file')", 'volume:[d1]file' ], +[ "VMS->canonpath('volume:[d1.-.d2.][d3.d4.-]')", 'volume:[d2.d3]' ], +[ "VMS->canonpath('volume:[000000.d1]d2.dir;1')", 'volume:[d1]d2.dir;1' ], + +[ "VMS->splitdir('')", '' ], +[ "VMS->splitdir('[]')", '' ], +[ "VMS->splitdir('d1.d2.d3')", 'd1,d2,d3' ], +[ "VMS->splitdir('[d1.d2.d3]')", 'd1,d2,d3' ], +[ "VMS->splitdir('.d1.d2.d3')", ',d1,d2,d3' ], +[ "VMS->splitdir('[.d1.d2.d3]')", ',d1,d2,d3' ], +[ "VMS->splitdir('.-.d2.d3')", ',-,d2,d3' ], +[ "VMS->splitdir('[.-.d2.d3]')", ',-,d2,d3' ], + +[ "VMS->catdir('')", '' ], +[ "VMS->catdir('d1','d2','d3')", '[.d1.d2.d3]' ], +[ "VMS->catdir('d1','d2/','d3')", '[.d1.d2.d3]' ], +[ "VMS->catdir('','d1','d2','d3')", '[.d1.d2.d3]' ], +[ "VMS->catdir('','-','d2','d3')", '[-.d2.d3]' ], +[ "VMS->catdir('','-','','d3')", '[-.d3]' ], +[ "VMS->catdir('dir.dir','d2.dir','d3.dir')", '[.dir.d2.d3]' ], +[ "VMS->catdir('[.name]')", '[.name]' ], +[ "VMS->catdir('[.name]','[.name]')", '[.name.name]'], + +[ "VMS->abs2rel('node::volume:[t1.t2.t3]','[t1.t2.t3]')", '' ], +[ "VMS->abs2rel('node::volume:[t1.t2.t4]','[t1.t2.t3]')", '[-.t4]' ], +[ "VMS->abs2rel('[t1.t2.t3]','[t1.t2.t3]')", '' ], +[ "VMS->abs2rel('[t1.t2.t3]file','[t1.t2.t3]')", 'file' ], +[ "VMS->abs2rel('[t1.t2.t4]','[t1.t2.t3]')", '[-.t4]' ], +[ "VMS->abs2rel('[t1.t2]file','[t1.t2.t3]')", '[-]file' ], +[ "VMS->abs2rel('[t1.t2.t3.t4]','[t1.t2.t3]')", '[t4]' ], +[ "VMS->abs2rel('[t4.t5.t6]','[t1.t2.t3]')", '[---.t4.t5.t6]' ], +[ "VMS->abs2rel('[000000]','[t1.t2.t3]')", '[---.000000]' ], +[ "VMS->abs2rel('a:[t1.t2.t4]','[t1.t2.t3]')", '[-.t4]' ], +[ "VMS->abs2rel('[a.-.b.c.-]','[t1.t2.t3]')", '[---.b]' ], + +[ "VMS->rel2abs('[.t4]','[t1.t2.t3]')", '[t1.t2.t3.t4]' ], +[ "VMS->rel2abs('[.t4.t5]','[t1.t2.t3]')", '[t1.t2.t3.t4.t5]' ], +[ "VMS->rel2abs('[]','[t1.t2.t3]')", '[t1.t2.t3]' ], +[ "VMS->rel2abs('[-]','[t1.t2.t3]')", '[t1.t2]' ], +[ "VMS->rel2abs('[-.t4]','[t1.t2.t3]')", '[t1.t2.t4]' ], +[ "VMS->rel2abs('[t1]','[t1.t2.t3]')", '[t1]' ], + +[ "OS2->catdir('A:/d1','B:/d2','d3','')", 'A:/d1/B:/d2/d3' ], +[ "OS2->catfile('a','b','c')", 'a/b/c' ], + +[ "Mac->splitpath('file')", ',,file' ], +[ "Mac->splitpath(':file')", ',:,file' ], +[ "Mac->splitpath(':d1',1)", ',:d1:,' ], +[ "Mac->splitpath('d1',1)", 'd1:,,' ], +[ "Mac->splitpath('d1:d2:d3:')", 'd1:,d2:d3:,' ], +[ "Mac->splitpath('d1:d2:d3',1)", 'd1:,d2:d3:,' ], +[ "Mac->splitpath(':d1:d2:d3:')", ',:d1:d2:d3:,' ], +[ "Mac->splitpath(':d1:d2:d3:',1)", ',:d1:d2:d3:,' ], +[ "Mac->splitpath('d1:d2:d3:file')", 'd1:,d2:d3:,file' ], +[ "Mac->splitpath('d1:d2:d3',1)", 'd1:,d2:d3:,' ], + +[ "Mac->catdir('')", ':' ], +[ "Mac->catdir('d1','d2','d3')", 'd1:d2:d3:' ], +[ "Mac->catdir('d1','d2/','d3')", 'd1:d2/:d3:' ], +[ "Mac->catdir('','d1','d2','d3')", ':d1:d2:d3:' ], +[ "Mac->catdir('','','d2','d3')", '::d2:d3:' ], +[ "Mac->catdir('','','','d3')", ':::d3:' ], +[ "Mac->catdir(':name')", ':name:' ], +[ "Mac->catdir(':name',':name')", ':name:name:' ], + +[ "Mac->catfile('a','b','c')", 'a:b:c' ], + +[ "Mac->canonpath('')", '' ], +[ "Mac->canonpath(':')", ':' ], +[ "Mac->canonpath('::')", '::' ], +[ "Mac->canonpath('a::')", 'a::' ], +[ "Mac->canonpath(':a::')", ':a::' ], + +[ "Mac->abs2rel('t1:t2:t3','t1:t2:t3')", ':' ], +[ "Mac->abs2rel('t1:t2','t1:t2:t3')", '::' ], +[ "Mac->abs2rel('t1:t4','t1:t2:t3')", ':::t4' ], +[ "Mac->abs2rel('t1:t2:t4','t1:t2:t3')", '::t4' ], +[ "Mac->abs2rel('t1:t2:t3:t4','t1:t2:t3')", ':t4' ], +[ "Mac->abs2rel('t4:t5:t6','t1:t2:t3')", '::::t4:t5:t6' ], +[ "Mac->abs2rel('t1','t1:t2:t3')", ':::' ], + +[ "Mac->rel2abs(':t4','t1:t2:t3')", 't1:t2:t3:t4' ], +[ "Mac->rel2abs(':t4:t5','t1:t2:t3')", 't1:t2:t3:t4:t5' ], +[ "Mac->rel2abs('','t1:t2:t3')", '' ], +[ "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' ], +) ; + +# Grab all of the plain routines from File::Spec +use File::Spec @File::Spec::EXPORT_OK ; + +require File::Spec::Unix ; +require File::Spec::Win32 ; + +eval { + require VMS::Filespec ; +} ; + +my $skip_exception = "Install VMS::Filespec (from vms/ext)" ; + +if ( $@ ) { + # Not pretty, but it allows testing of things not implemented soley + # on VMS. It might be better to change File::Spec::VMS to do this, + # making it more usable when running on (say) Unix but working with + # VMS paths. + eval qq- + sub File::Spec::VMS::vmsify { die "$skip_exception" } + sub File::Spec::VMS::unixify { die "$skip_exception" } + sub File::Spec::VMS::vmspath { die "$skip_exception" } + - ; + $INC{"VMS/Filespec.pm"} = 1 ; +} +require File::Spec::VMS ; + +require File::Spec::OS2 ; +require File::Spec::Mac ; + +print "1..", scalar( @tests ), "\n" ; + +my $current_test= 1 ; + +# Test out the class methods +for ( @tests ) { + tryfunc( @$_ ) ; +} + + + +# +# Tries a named function with the given args and compares the result against +# an expected result. Works with functions that return scalars or arrays. +# +sub tryfunc { + my $function = shift ; + my $expected = shift ; + my $platform = shift ; + + if ($platform && $^O ne $platform) { + print "ok $current_test # skipped: $function\n" ; + ++$current_test ; + return; + } + + $function =~ s#\\#\\\\#g ; + + my $got ; + if ( $function =~ /^[^\$].*->/ ) { + $got = eval( "join( ',', File::Spec::$function )" ) ; + } + else { + $got = eval( "join( ',', $function )" ) ; + } + + if ( $@ ) { + if ( substr( $@, 0, length $skip_exception ) eq $skip_exception ) { + chomp $@ ; + print "ok $current_test # skip $function: $@\n" ; + } + else { + chomp $@ ; + print "not ok $current_test # $function: $@\n" ; + } + } + elsif ( !defined( $got ) || $got ne $expected ) { + print "not ok $current_test # $function: got '$got', expected '$expected'\n" ; + } + else { + print "ok $current_test # $function\n" ; + } + ++$current_test ; +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
