r59018 - in /trunk/libpath-class-perl: ./ debian/ debian/patches/ debian/source/ lib/Path/ lib/Path/Class/ t/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Mon Jun 7 12:08:46 UTC 2010


Author: ansgar-guest
Date: Mon Jun  7 12:07:07 2010
New Revision: 59018

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59018
Log:
* New upstream release.
* debian/copyright: Update years of copyright.
* Use Build.PL.
* Use source format 3.0 (quilt).
* Fix spelling errors in documentation.
  + new patch: spelling.patch
* Bump Standards-Version to 3.8.4 (no changes).
* Add myself to Uploaders.

Added:
    trunk/libpath-class-perl/debian/patches/
    trunk/libpath-class-perl/debian/patches/series
    trunk/libpath-class-perl/debian/patches/spelling.patch
    trunk/libpath-class-perl/debian/source/
    trunk/libpath-class-perl/debian/source/format
    trunk/libpath-class-perl/t/04-subclass.t
      - copied unchanged from r59017, branches/upstream/libpath-class-perl/current/t/04-subclass.t
Modified:
    trunk/libpath-class-perl/Changes
    trunk/libpath-class-perl/MANIFEST
    trunk/libpath-class-perl/META.yml
    trunk/libpath-class-perl/SIGNATURE
    trunk/libpath-class-perl/debian/changelog
    trunk/libpath-class-perl/debian/control
    trunk/libpath-class-perl/debian/copyright
    trunk/libpath-class-perl/debian/rules
    trunk/libpath-class-perl/lib/Path/Class.pm
    trunk/libpath-class-perl/lib/Path/Class/Dir.pm
    trunk/libpath-class-perl/lib/Path/Class/Entity.pm
    trunk/libpath-class-perl/lib/Path/Class/File.pm
    trunk/libpath-class-perl/t/01-basic.t
    trunk/libpath-class-perl/t/03-filesystem.t

Modified: trunk/libpath-class-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/Changes?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/Changes (original)
+++ trunk/libpath-class-perl/Changes Mon Jun  7 12:07:07 2010
@@ -1,4 +1,23 @@
 Revision history for Perl extension Path::Class.
+
+0.19 - Sun Jun  6 20:50:27 CDT 2010
+
+ - slurp() now accepts an 'iolayers' option to control how the file is
+   opened. [Graham Barr]
+
+ - In the openr() and openw() file methods, we now croak() instead of
+   die() so that the error messages are more useful. [Ian Sillitoe]
+
+ - Allow subclassing, by adding dir_class() and file_class() static
+   methods, allowing them to be overridden. [Matt Trout & John LoVerso
+   & Michael Schwern]
+
+ - Fixed a testing failure that could occur whenever testing in a
+   directory path that contains symlinks (e.g. /tmp on Mac OS X).
+
+ - Added a 'no_hidden' parameter for children() [EDENC <EDENC at cpan.org>]
+
+ - Fixed the heading for the is_relative() POD section. [CUB <cub.uanic at gmail.com>]
 
 0.18 - Sun Dec 20 10:11:02 CST 2009
 

Modified: trunk/libpath-class-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/MANIFEST?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/MANIFEST (original)
+++ trunk/libpath-class-perl/MANIFEST Mon Jun  7 12:07:07 2010
@@ -12,4 +12,5 @@
 t/01-basic.t
 t/02-foreign.t
 t/03-filesystem.t
+t/04-subclass.t
 SIGNATURE    Added here by Module::Build

Modified: trunk/libpath-class-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/META.yml?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/META.yml (original)
+++ trunk/libpath-class-perl/META.yml Mon Jun  7 12:07:07 2010
@@ -1,6 +1,6 @@
 ---
 name: Path-Class
-version: 0.18
+version: 0.19
 author:
   - 'Ken Williams, KWILLIAMS at cpan.org'
 abstract: Cross-platform path specification manipulation
@@ -27,16 +27,16 @@
 provides:
   Path::Class:
     file: lib/Path/Class.pm
-    version: 0.18
+    version: 0.19
   Path::Class::Dir:
     file: lib/Path/Class/Dir.pm
-    version: 0.18
+    version: 0.19
   Path::Class::Entity:
     file: lib/Path/Class/Entity.pm
-    version: 0.18
+    version: 0.19
   Path::Class::File:
     file: lib/Path/Class/File.pm
-    version: 0.18
+    version: 0.19
 generated_by: Module::Build version 0.34
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html

Modified: trunk/libpath-class-perl/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/SIGNATURE?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/SIGNATURE (original)
+++ trunk/libpath-class-perl/SIGNATURE Mon Jun  7 12:07:07 2010
@@ -15,23 +15,24 @@
 Hash: SHA1
 
 SHA1 3e94b50826015fe7ac1e769cadd656b53317d4ab Build.PL
-SHA1 53e53939719140b2c7a8b40ce80271ab7136bec7 Changes
+SHA1 63cb36758d11d863e8e571b0f17350e513e73aaf Changes
 SHA1 066a2dba8084a0c2a7e4b6996ad21872bc16beb5 INSTALL
-SHA1 f38532f135ebd170454a00805504b38e89e0ae45 MANIFEST
-SHA1 f9a102dbc92707f088c02927886a7802fac4c3ff META.yml
+SHA1 a0a13d88e63cfd5b6f8a6ce1d23838c407b747e0 MANIFEST
+SHA1 00ee2bcb5f7534eeea92414289f947d1635b99f8 META.yml
 SHA1 13ec5ef969c9758358bdd8b5cd6b71e7e9d775d9 Makefile.PL
 SHA1 a7b1cdcddb8679dff993b475939abcfb73076afb README
-SHA1 280e55c273c8477e3cba803d55d7e3da32addd79 lib/Path/Class.pm
-SHA1 96bded96bf637945f61c51a1343fdbc6bb1204f0 lib/Path/Class/Dir.pm
-SHA1 9f57fa6892675473a08d38e68dbc69265857afc0 lib/Path/Class/Entity.pm
-SHA1 071f26594c4b1bae1deb36cc88d1f9fa4f56839d lib/Path/Class/File.pm
-SHA1 220f7d1d24731b7ae889e1b74c4306dbe552ffca t/01-basic.t
+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 6d11d3c96fd1db41c336d3014e3224076e283676 t/03-filesystem.t
+SHA1 24d2084a948436d73ce01e4f12db41c575d097bb t/03-filesystem.t
+SHA1 a163d4cf70142b45974ed39c78571e7ce2ba5a7f t/04-subclass.t
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (Darwin)
 
-iD8DBQFLLkzGgrvMBLfvlHYRAhOUAKCPxlij4/xWHp8on6oHYOvmGctTcgCfYIuX
-u9L8eaNynr/UMYbYGwXd0FA=
-=gxNA
+iD8DBQFMDFEegrvMBLfvlHYRAoqvAJ0VE8+5f75S4syeBSRQP92GugI2QACgg/vX
+BIVv1OSNZnTOOA5GJiK2uR8=
+=CjOC
 -----END PGP SIGNATURE-----

Modified: trunk/libpath-class-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/debian/changelog?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/debian/changelog (original)
+++ trunk/libpath-class-perl/debian/changelog Mon Jun  7 12:07:07 2010
@@ -1,3 +1,16 @@
+libpath-class-perl (0.19-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/copyright: Update years of copyright.
+  * Use Build.PL.
+  * Use source format 3.0 (quilt).
+  * Fix spelling errors in documentation.
+    + new patch: spelling.patch
+  * Bump Standards-Version to 3.8.4 (no changes).
+  * Add myself to Uploaders.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Mon, 07 Jun 2010 21:06:29 +0900
+
 libpath-class-perl (0.18-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/libpath-class-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/debian/control?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/debian/control (original)
+++ trunk/libpath-class-perl/debian/control Mon Jun  7 12:07:07 2010
@@ -1,12 +1,12 @@
 Source: libpath-class-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 7)
+Build-Depends: debhelper (>= 7.3.7~), perl (>= 5.10) | libmodule-build-perl
 Build-Depends-Indep: perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Salvatore Bonaccorso <salvatore.bonaccorso at gmail.com>,
- Jonathan Yu <jawnsy at cpan.org>
-Standards-Version: 3.8.3
+ Jonathan Yu <jawnsy at cpan.org>, Ansgar Burchardt <ansgar at 43-1.org>
+Standards-Version: 3.8.4
 Homepage: http://search.cpan.org/dist/Path-Class/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libpath-class-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libpath-class-perl/

Modified: trunk/libpath-class-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/debian/copyright?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/debian/copyright (original)
+++ trunk/libpath-class-perl/debian/copyright Mon Jun  7 12:07:07 2010
@@ -4,7 +4,7 @@
 Name: Path-Class
 
 Files: *
-Copyright: 2003-2009, Ken Williams <KWILLIAMS at cpan.org>
+Copyright: 2003-2010, Ken Williams <KWILLIAMS at cpan.org>
 License: Artistic or GPL-1+
 X-Comment: 
  Years of copyright deduced from Changes and release dates.

Added: trunk/libpath-class-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/debian/patches/series?rev=59018&op=file
==============================================================================
--- trunk/libpath-class-perl/debian/patches/series (added)
+++ trunk/libpath-class-perl/debian/patches/series Mon Jun  7 12:07:07 2010
@@ -1,0 +1,1 @@
+spelling.patch

Added: trunk/libpath-class-perl/debian/patches/spelling.patch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/debian/patches/spelling.patch?rev=59018&op=file
==============================================================================
--- trunk/libpath-class-perl/debian/patches/spelling.patch (added)
+++ trunk/libpath-class-perl/debian/patches/spelling.patch Mon Jun  7 12:07:07 2010
@@ -1,0 +1,36 @@
+From: Ansgar Burchardt <ansgar at 43-1.org>
+Date: Mon, 07 Jun 2010 21:03:02 +0900
+Subject: Fix spelling errors
+Forwarded: https://rt.cpan.org/Ticket/Display.html?id=58195
+
+--- libpath-class-perl.orig/lib/Path/Class/Dir.pm
++++ libpath-class-perl/lib/Path/Class/Dir.pm
+@@ -638,7 +638,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
+ 
+--- libpath-class-perl.orig/lib/Path/Class/File.pm
++++ libpath-class-perl/lib/Path/Class/File.pm
+@@ -299,7 +299,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 +334,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
+ 

Modified: trunk/libpath-class-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/debian/rules?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/debian/rules (original)
+++ trunk/libpath-class-perl/debian/rules Mon Jun  7 12:07:07 2010
@@ -1,4 +1,4 @@
 #!/usr/bin/make -f
 
 %:
-	dh $@
+	dh --buildsystem=perl_build $@

Added: trunk/libpath-class-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/debian/source/format?rev=59018&op=file
==============================================================================
--- trunk/libpath-class-perl/debian/source/format (added)
+++ trunk/libpath-class-perl/debian/source/format Mon Jun  7 12:07:07 2010
@@ -1,0 +1,1 @@
+3.0 (quilt)

Modified: trunk/libpath-class-perl/lib/Path/Class.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/lib/Path/Class.pm?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/lib/Path/Class.pm (original)
+++ trunk/libpath-class-perl/lib/Path/Class.pm Mon Jun  7 12:07:07 2010
@@ -1,6 +1,6 @@
 package Path::Class;
 
-$VERSION = '0.18';
+$VERSION = '0.19';
 @ISA = qw(Exporter);
 @EXPORT    = qw(file dir);
 @EXPORT_OK = qw(file dir foreign_file foreign_dir);

Modified: trunk/libpath-class-perl/lib/Path/Class/Dir.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/lib/Path/Class/Dir.pm?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/lib/Path/Class/Dir.pm (original)
+++ trunk/libpath-class-perl/lib/Path/Class/Dir.pm Mon Jun  7 12:07:07 2010
@@ -1,15 +1,19 @@
 package Path::Class::Dir;
 
-$VERSION = '0.18';
+$VERSION = '0.19';
 
 use strict;
 use Path::Class::File;
-use Path::Class::Entity;
 use Carp();
 use base qw(Path::Class::Entity);
 
 use IO::Dir ();
 use File::Path ();
+
+# updir & curdir on the local machine, for screening them out in
+# children().  Note that they don't respect 'foreign' semantics.
+my $Updir  = __PACKAGE__->_spec->updir;
+my $Curdir = __PACKAGE__->_spec->curdir;
 
 sub new {
   my $self = shift->SUPER::new();
@@ -33,6 +37,8 @@
   return $self;
 }
 
+sub file_class { "Path::Class::File" }
+
 sub is_dir { 1 }
 
 sub as_foreign {
@@ -62,7 +68,7 @@
 
 sub file {
   local $Path::Class::Foreign = $_[0]->{file_spec_class} if $_[0]->{file_spec_class};
-  return Path::Class::File->new(@_);
+  return $_[0]->file_class->new(@_);
 }
 
 sub dir_list {
@@ -174,12 +180,19 @@
   
   my @out;
   while (defined(my $entry = $dh->read)) {
-    # XXX What's the right cross-platform way to do this?
-    next if (!$opts{all} && ($entry eq '.' || $entry eq '..'));
+    next if !$opts{all} && $self->_is_local_dot_dir($entry);
+    next if ($opts{no_hidden} && $entry =~ /^\./);
     push @out, $self->file($entry);
     $out[-1] = $self->subdir($entry) if -d $out[-1];
   }
   return @out;
+}
+
+sub _is_local_dot_dir {
+  my $self = shift;
+  my $dir  = shift;
+
+  return ($dir eq $Updir or $dir eq $Curdir);
 }
 
 sub next {
@@ -461,6 +474,13 @@
   @c = $dir->children(); # Just the children
   @c = $dir->children(all => 1); # All entries
 
+In addition, there's a C<no_hidden> parameter that will exclude all
+normally "hidden" entries - on Unix this means excluding all entries
+that begin with a dot (C<.>):
+
+  @c = $dir->children(no_hidden => 1); # Just normally-visible entries
+
+
 =item $abs = $dir->absolute
 
 Returns a C<Path::Class::Dir> object representing C<$dir> as an
@@ -614,6 +634,12 @@
 Same as C<stat()>, but if C<$file> is a symbolic link, C<lstat()>
 stats the link instead of the directory the link points to.
 
+=item $class = $file->file_class()
+
+Returns the class which should be used to create file objects.
+
+Generally overriden whenever this class is subclassed.
+
 =back
 
 =head1 AUTHOR

Modified: trunk/libpath-class-perl/lib/Path/Class/Entity.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/lib/Path/Class/Entity.pm?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/lib/Path/Class/Entity.pm (original)
+++ trunk/libpath-class-perl/lib/Path/Class/Entity.pm Mon Jun  7 12:07:07 2010
@@ -1,6 +1,6 @@
 package Path::Class::Entity;
 
-$VERSION = '0.18';
+$VERSION = '0.19';
 
 use strict;
 use File::Spec;
@@ -39,7 +39,7 @@
   return $class->new(@_);
 }
 
-sub _spec { $_[0]->{file_spec_class} || 'File::Spec' }
+sub _spec { (ref($_[0]) && $_[0]->{file_spec_class}) || 'File::Spec' }
 
 sub boolify { 1 }
   

Modified: trunk/libpath-class-perl/lib/Path/Class/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/lib/Path/Class/File.pm?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/lib/Path/Class/File.pm (original)
+++ trunk/libpath-class-perl/lib/Path/Class/File.pm Mon Jun  7 12:07:07 2010
@@ -1,11 +1,11 @@
 package Path::Class::File;
 
-$VERSION = '0.18';
+$VERSION = '0.19';
 
 use strict;
 use Path::Class::Dir;
-use Path::Class::Entity;
 use base qw(Path::Class::Entity);
+use Carp;
 
 use IO::File ();
 
@@ -20,11 +20,13 @@
     push @dirs, $self->_spec->catpath($volume, $dirs, '');
   }
   
-  $self->{dir}  = @dirs ? Path::Class::Dir->new(@dirs) : undef;
+  $self->{dir}  = @dirs ? $self->dir_class->new(@dirs) : undef;
   $self->{file} = $base;
   
   return $self;
 }
+
+sub dir_class { "Path::Class::Dir" }
 
 sub as_foreign {
   my ($self, $type) = @_;
@@ -44,7 +46,7 @@
 sub dir {
   my $self = shift;
   return $self->{dir} if defined $self->{dir};
-  return Path::Class::Dir->new($self->_spec->curdir);
+  return $self->dir_class->new($self->_spec->curdir);
 }
 BEGIN { *parent = \&dir; }
 
@@ -57,8 +59,8 @@
 sub basename { shift->{file} }
 sub open  { IO::File->new(@_) }
 
-sub openr { $_[0]->open('r') or die "Can't read $_[0]: $!"  }
-sub openw { $_[0]->open('w') or die "Can't write $_[0]: $!" }
+sub openr { $_[0]->open('r') or croak "Can't read $_[0]: $!"  }
+sub openw { $_[0]->open('w') or croak "Can't write $_[0]: $!" }
 
 sub touch {
   my $self = shift;
@@ -72,7 +74,8 @@
 
 sub slurp {
   my ($self, %args) = @_;
-  my $fh = $self->openr;
+  my $iomode = $args{iomode} || 'r';
+  my $fh = $self->open($iomode) or croak "Can't read $self: $!";
 
   if ($args{chomped} or $args{chomp}) {
     chomp( my @data = <$fh> );
@@ -194,7 +197,7 @@
 Returns true or false depending on whether the file refers to an
 absolute path specifier (like C</usr/local/foo.txt> or C<\Windows\Foo.txt>).
 
-=item $file->is_absolute
+=item $file->is_relative
 
 Returns true or false depending on whether the file refers to a
 relative path specifier (like C<lib/foo.txt> or C<.\Foo.txt>).
@@ -270,13 +273,13 @@
 
 A shortcut for
 
- $fh = $file->open('r') or die "Can't read $file: $!";
+ $fh = $file->open('r') or croak "Can't read $file: $!";
 
 =item $fh = $file->openw()
 
 A shortcut for
 
- $fh = $file->open('w') or die "Can't write $file: $!";
+ $fh = $file->open('w') or croak "Can't write $file: $!";
 
 =item $file->touch
 
@@ -296,6 +299,16 @@
 
   my @lines = $file->slurp(chomp => 1);
 
+You may also use the C<iomode> paramter 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.
+
+  my @lines = $file->slurp(iomode => ':crlf');
+  my $lines = $file->slurp(iomode => '<:encoding(UTF−8)');
+
+The default C<iomode> is C<r>.
+
 =item $file->remove()
 
 This method will remove the file in a way that works well on all
@@ -317,6 +330,12 @@
 Same as C<stat()>, but if C<$file> is a symbolic link, C<lstat()>
 stats the link instead of the file the link points to.
 
+=item $class = $file->dir_class()
+
+Returns the class which should be used to create directory objects.
+
+Generally overriden whenever this class is subclassed.
+
 =back
 
 =head1 AUTHOR

Modified: trunk/libpath-class-perl/t/01-basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/t/01-basic.t?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/t/01-basic.t (original)
+++ trunk/libpath-class-perl/t/01-basic.t Mon Jun  7 12:07:07 2010
@@ -79,7 +79,7 @@
   ok dir(''), '/';
   ok dir(), '.';
   ok dir('', 'var', 'tmp'), '/var/tmp';
-  ok dir()->absolute, dir(Cwd::cwd())->cleanup;
+  ok dir()->absolute->resolve, dir(Cwd::cwd())->resolve;
   ok dir(undef), undef;
 }
 

Modified: trunk/libpath-class-perl/t/03-filesystem.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpath-class-perl/t/03-filesystem.t?rev=59018&op=diff
==============================================================================
--- trunk/libpath-class-perl/t/03-filesystem.t (original)
+++ trunk/libpath-class-perl/t/03-filesystem.t Mon Jun  7 12:07:07 2010
@@ -4,7 +4,7 @@
 use File::Temp qw(tmpnam tempdir);
 use File::Spec;
 
-plan tests => 72;
+plan tests => 78;
 
 use_ok 'Path::Class';
 
@@ -142,6 +142,31 @@
 
   @content = $file->slurp(chomp => 1);
   is_deeply \@content, ["Line1", "Line2"];
+
+  $file->remove;
+  ok not -e $file;
+}
+
+{
+  my $file = file('t', 'slurp');
+  ok $file;
+  
+  my $fh = $file->open('>:raw') or die "Can't create $file: $!";
+  print $fh "Line1\r\nLine2\r\n\302\261\r\n";
+  close $fh;
+  ok -e $file;
+  
+  my $content = $file->slurp(iomode => '<:raw');
+  is $content, "Line1\r\nLine2\r\n\302\261\r\n";
+  
+  my $line3 = "\302\261\n";
+  utf8::decode($line3);
+  my @content = $file->slurp(iomode => '<:crlf:utf8');
+  is_deeply \@content, ["Line1\n", "Line2\n", $line3];
+
+  chop($line3);
+  @content = $file->slurp(chomp => 1, iomode => '<:crlf:utf8');
+  is_deeply \@content, ["Line1", "Line2", $line3];
 
   $file->remove;
   ok not -e $file;




More information about the Pkg-perl-cvs-commits mailing list