[SCM] libpath-tiny-perl Debian packaging branch, master, updated. debian/0.020-1-13-g8895609
David Golden
dagolden at cpan.org
Tue May 28 16:27:17 UTC 2013
The following commit has been merged in the master branch:
commit 712e28124ccdaf27c3227d998021c683e9938eee
Author: David Golden <dagolden at cpan.org>
Date: Fri May 17 22:52:24 2013 -0400
fix fatal bug with lines_utf8 and chomp
diff --git a/lib/Path/Tiny.pm b/lib/Path/Tiny.pm
index 82da725..acc4b99 100644
--- a/lib/Path/Tiny.pm
+++ b/lib/Path/Tiny.pm
@@ -605,7 +605,7 @@ sub lines_utf8 {
&& $args->{chomp}
&& !$args->{count} )
{
- return split /\n/, slurp_utf8( $_[0] ); ## no critic
+ return split /\n/, slurp_utf8( $self ); ## no critic
}
else {
$args->{binmode} = ":raw:encoding(UTF-8)";
diff --git a/t/input_output.t b/t/input_output.t
index 4ed0ca4..f10d317 100644
--- a/t/input_output.t
+++ b/t/input_output.t
@@ -120,6 +120,22 @@ subtest "spew -> lines (count, UTF-8)" => sub {
is( join( '', $file->lines_utf8( { count => 3 } ) ), join( '', @exp ), "lines" );
};
+subtest "spew -> lines (count, chomp, UTF-8)" => sub {
+ my $file = Path::Tiny->tempfile;
+ ok( $file->spew_utf8(_utf8_lines), "spew" );
+ my @exp = map { chomp; $_ } _utf8_lines;
+ is( join( '', $file->lines_utf8( { chomp => 1, count => 2 } ) ),
+ join( '', @exp[ 0 .. 1 ] ), "lines" );
+};
+
+subtest "spew -> lines (chomp, UTF-8)" => sub {
+ my $file = Path::Tiny->tempfile;
+ ok( $file->spew_utf8(_utf8_lines), "spew" );
+ my @exp = map { chomp; $_ } _utf8_lines;
+ is( join( '', $file->lines_utf8( { chomp => 1 } ) ),
+ join( '', @exp ), "lines" );
+};
+
subtest "spew -> lines (count, raw)" => sub {
my $file = Path::Tiny->tempfile;
ok( $file->spew_raw(_lines), "spew" );
--
libpath-tiny-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list