diff -Nru libfile-slurp-perl-9999.16/Changes libfile-slurp-perl-9999.19/Changes --- libfile-slurp-perl-9999.16/Changes 2011-04-16 09:12:21.000000000 +0000 +++ libfile-slurp-perl-9999.19/Changes 2011-06-07 08:06:13.000000000 +0000 @@ -1,5 +1,28 @@ Revision history File::Slurp +9999.19 Tue Jun 7 04:06:06 EDT 2011 + - Fixed use line in t/edit_file.t to import :edit first + Thanks to paul + - read_file and write_file work even when interrupted by signals + this includes a test for read_file interrupt + Thanks to Andrew Danforth + - Fixed bugs in the config synopsis example + +9999.18 Fri May 13 02:30:05 EDT 2011 + - Added :std and :edit export tags + - Cleaned up EXPORT vars + - Documented importing edit_file and edit_file_lines + - Fixed some pod spelling + +9999.17 Wed Apr 27 02:20:03 EDT 2011 + - Requiring Perl 5.6.2 (first time older Perls were dropped) + This is because of use of the re 'taint' pragma + - Added major new features: edit_file and edit_file_lines + - Speed up of tainted slurp with return of lines + - Added chomp option to read_file + - Added prefix option to read_dir + - Fixed optimization of reading small files. + 9999.16 Wed Apr 13 03:47:26 EDT 2011 - Added support for read_file options to be a hash reference. - Added support for read_dir options to be a hash reference. diff -Nru libfile-slurp-perl-9999.16/debian/changelog libfile-slurp-perl-9999.19/debian/changelog --- libfile-slurp-perl-9999.16/debian/changelog 2011-10-17 13:37:38.000000000 +0000 +++ libfile-slurp-perl-9999.19/debian/changelog 2011-10-17 13:37:39.000000000 +0000 @@ -1,3 +1,10 @@ +libfile-slurp-perl (9999.19-1) unstable; urgency=low + + * New upstream release, + new watchfile as the upstream changed again (closes: #639815) + + -- Alexander Zangerl Wed, 31 Aug 2011 10:09:27 +1000 + libfile-slurp-perl (9999.16-1) unstable; urgency=low * New upstream release (more robust wrt. utf-8) diff -Nru libfile-slurp-perl-9999.16/debian/patches/01_binmode.dpatch libfile-slurp-perl-9999.19/debian/patches/01_binmode.dpatch --- libfile-slurp-perl-9999.16/debian/patches/01_binmode.dpatch 2011-10-17 13:37:38.000000000 +0000 +++ libfile-slurp-perl-9999.19/debian/patches/01_binmode.dpatch 2011-10-17 13:37:39.000000000 +0000 @@ -5,21 +5,21 @@ ## DP: binmode fix for multibyte-encoded data @DPATCH@ -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.16~/MANIFEST libfile-slurp-perl-9999.16/MANIFEST ---- libfile-slurp-perl-9999.16~/MANIFEST 2011-03-21 06:27:55.000000000 +1000 -+++ libfile-slurp-perl-9999.16/MANIFEST 2011-05-11 19:14:00.393079954 +1000 -@@ -29,6 +29,8 @@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.19~/MANIFEST libfile-slurp-perl-9999.19/MANIFEST +--- libfile-slurp-perl-9999.19~/MANIFEST 2011-05-24 15:16:12.000000000 +1000 ++++ libfile-slurp-perl-9999.19/MANIFEST 2011-08-31 10:17:55.750011076 +1000 +@@ -33,6 +33,8 @@ t/stringify.t t/tainted.t t/write_file_win32.t +t/utf8.data +t/utf8.t - experiment/prepend.pl - experiment/edit_file.pl extras/slurp_bench.pl -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.16~/META.yml libfile-slurp-perl-9999.16/META.yml ---- libfile-slurp-perl-9999.16~/META.yml 2011-04-24 14:24:46.000000000 +1000 -+++ libfile-slurp-perl-9999.16/META.yml 2011-05-11 19:14:38.797416453 +1000 + extras/FileSlurp_12.pm + extras/slurp_article.pod +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.19~/META.yml libfile-slurp-perl-9999.19/META.yml +--- libfile-slurp-perl-9999.19~/META.yml 2011-08-31 10:16:49.000000000 +1000 ++++ libfile-slurp-perl-9999.19/META.yml 2011-08-31 10:17:12.501430635 +1000 @@ -8,6 +8,7 @@ generated_by: ExtUtils::MakeMaker version 6.42 distribution_type: module @@ -28,16 +28,16 @@ Carp: 0 Exporter: 0 Fcntl: 0 -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.16~/t/utf8.data libfile-slurp-perl-9999.16/t/utf8.data ---- libfile-slurp-perl-9999.16~/t/utf8.data 1970-01-01 10:00:00.000000000 +1000 -+++ libfile-slurp-perl-9999.16/t/utf8.data 2011-05-11 19:12:19.265093862 +1000 +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.19~/t/utf8.data libfile-slurp-perl-9999.19/t/utf8.data +--- libfile-slurp-perl-9999.19~/t/utf8.data 1970-01-01 10:00:00.000000000 +1000 ++++ libfile-slurp-perl-9999.19/t/utf8.data 2011-08-31 10:17:12.501430635 +1000 @@ -0,0 +1,3 @@ +hallo grüezi blödel schaß und aus. +Gregorian: ლრ +Arabic: ڐڡڠڟڞ -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.16~/t/utf8.t libfile-slurp-perl-9999.16/t/utf8.t ---- libfile-slurp-perl-9999.16~/t/utf8.t 1970-01-01 10:00:00.000000000 +1000 -+++ libfile-slurp-perl-9999.16/t/utf8.t 2011-05-11 19:12:19.265093862 +1000 +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.19~/t/utf8.t libfile-slurp-perl-9999.19/t/utf8.t +--- libfile-slurp-perl-9999.19~/t/utf8.t 1970-01-01 10:00:00.000000000 +1000 ++++ libfile-slurp-perl-9999.19/t/utf8.t 2011-08-31 10:17:12.501430635 +1000 @@ -0,0 +1,40 @@ +#!/usr/bin/perl +use Test::More tests => 4; @@ -79,9 +79,9 @@ + + + -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.16~/t/utf8.t.alt libfile-slurp-perl-9999.16/t/utf8.t.alt ---- libfile-slurp-perl-9999.16~/t/utf8.t.alt 1970-01-01 10:00:00.000000000 +1000 -+++ libfile-slurp-perl-9999.16/t/utf8.t.alt 2011-05-11 19:12:19.265093862 +1000 +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libfile-slurp-perl-9999.19~/t/utf8.t.alt libfile-slurp-perl-9999.19/t/utf8.t.alt +--- libfile-slurp-perl-9999.19~/t/utf8.t.alt 1970-01-01 10:00:00.000000000 +1000 ++++ libfile-slurp-perl-9999.19/t/utf8.t.alt 2011-08-31 10:17:12.502430579 +1000 @@ -0,0 +1,19 @@ +use Test::More tests => 1; +use strict; diff -Nru libfile-slurp-perl-9999.16/debian/watch libfile-slurp-perl-9999.19/debian/watch --- libfile-slurp-perl-9999.16/debian/watch 2011-10-17 13:37:38.000000000 +0000 +++ libfile-slurp-perl-9999.19/debian/watch 2011-10-17 13:37:39.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -http://www.cpan.org/authors/id/D/DR/DROLSKY/File-Slurp-(.*)\.tar\.gz debian +http://search.cpan.org/dist/File-Slurp/ .*/File-Slurp-v?(\d[\d.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ diff -Nru libfile-slurp-perl-9999.16/experiment/edit_file.pl libfile-slurp-perl-9999.19/experiment/edit_file.pl --- libfile-slurp-perl-9999.16/experiment/edit_file.pl 2011-03-25 04:26:57.000000000 +0000 +++ libfile-slurp-perl-9999.19/experiment/edit_file.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,200 +0,0 @@ - -use strict ; -use warnings ; - -use lib '../blib' ; -use lib '../t' ; - -use File::Slurp ; -use Test::More ; - -use TestDriver ; - -my $file = 'edit_file' ; -my $existing_data = <
{ scalar_ref } = 1 ;
-
-	my $existing_data = read_file( $file_name, %{$opts} ) ;
-
-#print "EXIST [$$existing_data]\n" ;
-
-	$opts->{ atomic } = 1 ;
-
-	my( $edited_data ) = map { $edit_code->(); $_ } $$existing_data ;
-
-	return write_file( $file_name, $opts, $edited_data ) ;
-}
-
-my $tests = [
-	{
-		name	=> 'no edit 0',
-		sub	=> \&edit_file,
-		code	=> sub {},
-		pretest	=> sub {
-			my( $test ) = @_ ;
-			write_file( $file, $existing_data ) ;
-			$test->{args} = [
-				$test->{code},
-				$file
-			] ;
-			( $test->{expected} ) =
-				map { $test->{code}() ; $_ } $existing_data ;
-		},
-		posttest => sub { $_[0]->{result} = read_file( $file ) },
-	},
-	{
-		name	=> 'change edit',
-		sub	=> \&edit_file,
-		code	=> sub { s/line/foo/g },
-		pretest	=> sub {
-			my( $test ) = @_ ;
-			write_file( $file, $existing_data ) ;
-			$test->{args} = [
-				$test->{code},
-				$file
-			] ;
-			( $test->{expected} ) =
-				map { $test->{code}() ; $_ } $existing_data ;
-		},
-		posttest => sub { $_[0]->{result} = read_file( $file ) },
-	},
-	{
-		name	=> 'change edit',
-		sub	=> \&edit_file,
-		code	=> sub { s/^.+2$//m },
-		pretest	=> sub {
-			my( $test ) = @_ ;
-			write_file( $file, $existing_data ) ;
-			$test->{args} = [
-				$test->{code},
-				$file
-			] ;
-			( $test->{expected} ) =
-				map { $test->{code}() ; $_ } $existing_data ;
-		},
-		posttest => sub { $_[0]->{result} = read_file( $file ) },
-	},
-	{
-		name	=> 'delete all',
-		sub	=> \&edit_file,
-		code	=> sub { $_ = '' },
-		pretest	=> sub {
-			my( $test ) = @_ ;
-			write_file( $file, $existing_data ) ;
-			$test->{args} = [
-				$test->{code},
-				$file
-			] ;
-			( $test->{expected} ) =
-				map { $test->{code}() ; $_ } $existing_data ;
-		},
-		posttest => sub { $_[0]->{result} = read_file( $file ) },
-	},
-	{
-		name	=> 'utf8',
-		sub	=> \&edit_file,
-		code	=> sub { s/abc// },
-		pretest	=> sub {
-			my( $test ) = @_ ;
-
-			my $orig_text = "abc\x{20ac}\n" ;
-			$orig_text =~ s/\n/\015\012/ if $^O =~ /win32/i ;
-			write_file( $file, {binmode => ':utf8'}, $orig_text ) ;
-			$test->{args} = [
-				$test->{code},
-				$file,
-				{ binmode => ':utf8' },
-			] ;
-			( $test->{expected} ) =
-				map { $test->{code}() ; $_ } $orig_text ;
-		},
-		posttest => sub { $_[0]->{result} =
-			read_file( $file, binmode => ':utf8' )
-		},
-	},
-] ;
-
-test_driver( $tests ) ;
-
-unlink $file ;
-
-exit ;
-
-__END__
-
-=head2 B
-
-This sub writes out an entire file in one call.
-
-  write_file( 'filename', @data ) ;
-
-The first argument to C is the filename. The next argument
-is an optional hash reference and it contains key/values that can
-modify the behavior of C. The rest of the argument list is
-the data to be written to the file.
-
-  write_file( 'filename', {append => 1 }, @data ) ;
-  write_file( 'filename', {binmode => ':raw'}, $buffer ) ;
-
-As a shortcut if the first data argument is a scalar or array reference,
-it is used as the only data to be written to the file. Any following
-arguments in @_ are ignored. This is a faster way to pass in the output
-to be written to the file and is equivalent to the C option of
-C. These following pairs are equivalent but the pass by
-reference call will be faster in most cases (especially with larger
-files).
-
-  write_file( 'filename', \$buffer ) ;
-  write_file( 'filename', $buffer ) ;
-
-  write_file( 'filename', \@lines ) ;
-  write_file( 'filename', @lines ) ;
-
-If the first argument is a handle (if it is a ref and is an IO or GLOB
-object), then that handle is written to. This mode is supported so you
-spew to handles such as \*STDOUT. See the test handle.t for an example
-that does C and child process spews data to the parent
-which slurps it in.  All of the options that control how the data are
-passed into C still work in this case.
-
-If the first argument is an overloaded object then its stringified value
-is used for the filename and that file is opened.  This is new feature
-in 9999.14. See the stringify.t test for an example.
-
-By default C returns 1 upon successfully writing the file or
-undef if it encountered an error. You can change how errors are handled
-with the C option.
-
-The options are:
-
-=head3 binmode
-
-If you set the binmode option, then its value is passed to a call to
-binmode on the opened handle. You can use this to set the file to be
-read in binary mode, utf8, etc. See perldoc -f binmode for more.
-
-	write_file( $bin_file, {binmode => ':raw'}, @data ) ;
-	write_file( $bin_file, {binmode => ':utf8'}, $utf_text ) ;
-
-=head3 perms
-
-The perms option sets the permissions of newly-created files. This value
-is modified by your process's umask and defaults to 0666 (same as
-sysopen).
-
-NOTE: this option is new as of File::Slurp version 9999.14;
-
diff -Nru libfile-slurp-perl-9999.16/experiment/prepend.pl libfile-slurp-perl-9999.19/experiment/prepend.pl
--- libfile-slurp-perl-9999.16/experiment/prepend.pl	2011-03-25 04:37:45.000000000 +0000
+++ libfile-slurp-perl-9999.19/experiment/prepend.pl	1970-01-01 00:00:00.000000000 +0000
@@ -1,149 +0,0 @@
-
-use strict ;
-use warnings ;
-
-use lib '../blib' ;
-use lib '../t' ;
-
-use File::Slurp ;
-use Test::More ;
-
-use TestDriver ;
-
-my $file = 'prepend_file' ;
-my $existing_data = <
{ scalar_ref } = 1 ;
-
-	my $existing_data = read_file( $file_name, %{$opts} ) ;
-
-#print "EXIST [$$existing_data]\n" ;
-
-	$opts->{ atomic } = 1 ;
-
-	return write_file( $file_name, $opts,
-			   $prepend_data, $$existing_data
-	) ;
-}
-
-my $tests = [
-	{
-		name	=> 'prepend null',
-		sub	=> \&prepend_file,
-		prepend_data	=> '',
-		pretest	=> sub {
-			my( $test ) = @_ ;
-			write_file( $file, $existing_data ) ;
-			my $prepend_data = $test->{prepend_data} ;
-			$test->{args} = [
-				$file,
-				$prepend_data,
-			] ;
-			$test->{expected} = "$prepend_data$existing_data" ;
-		},
-		posttest => sub { $_[0]->{result} = read_file( $file ) },
-	},
-	{
-		name	=> 'prepend line',
-		sub	=> \&prepend_file,
-		prepend_data => "line 0\n",
-		pretest	=> sub {
-			my( $test ) = @_ ;
-			write_file( $file, $existing_data ) ;
-			my $prepend_data = $test->{prepend_data} ;
-			$test->{args} = [
-				$file,
-				$prepend_data,
-			] ;
-			$test->{expected} = "$prepend_data$existing_data" ;
-		},
-		posttest => sub { $_[0]->{result} = read_file( $file ) },
-	},
-	{
-		name	=> 'prepend partial line',
-		sub	=> \&prepend_file,
-		prepend_data => 'partial line',
-		pretest	=> sub {
-			my( $test ) = @_ ;
-			write_file( $file, $existing_data ) ;
-			my $prepend_data = $test->{prepend_data} ;
-			$test->{args} = [
-				$file,
-				$prepend_data,
-			] ;
-			$test->{expected} = "$prepend_data$existing_data" ;
-		},
-		posttest => sub { $_[0]->{result} = read_file( $file ) },
-	},
-] ;
-
-test_driver( $tests ) ;
-
-unlink $file ;
-
-exit ;
-
-__END__
-
-=head2 B
-
-This sub writes data to the beginning of a file. The previously
-existing data is written after that so the effect is prepending data
-in front of a file. It is a counterpart to the append_file sub in this
-module.
-
-  use File::Slurp qw( prepend_file ) ;
-  prepend_file( 'filename', @data ) ;
-
-The first argument to C is the filename. The next argument
-is an optional hash reference and it contains key/values that can
-modify the behavior of C. The rest of the argument list is
-the data to be written to the file.
-
-  prepend_file( 'filename', {binmode => ':raw'}, $buffer ) ;
-
-C works by calling C and then C
-with the new data and the existing data just read in. Read the
-documentation for those calls for details not covered here.
-
-The options are:
-
-=head3 binmode
-
-If you set the binmode option, then its value is passed to a call to
-binmode on the opened handle. You can use this to set the file to be
-read in binary mode, utf8, etc. See perldoc -f binmode for more.
-
-	prepend_file( $bin_file, {binmode => ':raw'}, @data ) ;
-	prepend_file( $bin_file, {binmode => ':utf8'}, $utf_text ) ;
-
-=head3 err_mode
-
-You can use this option to control how C behaves when an
-error occurs. See the documentation in C and C
-for more on this.
-
-=head3 atomic mode is always enabled
-
-In the internal call to C, the C flag is always
-set which means you will always have a stable file, either the old one
-or the complete new one. See the C option in C for
-more on this.
diff -Nru libfile-slurp-perl-9999.16/lib/File/Slurp.pm libfile-slurp-perl-9999.19/lib/File/Slurp.pm
--- libfile-slurp-perl-9999.16/lib/File/Slurp.pm	2011-04-16 07:22:57.000000000 +0000
+++ libfile-slurp-perl-9999.19/lib/File/Slurp.pm	2011-05-30 19:58:53.000000000 +0000
@@ -1,26 +1,53 @@
 package File::Slurp;
 
-my $printed ;
+use 5.6.2 ;
 
 use strict;
+use warnings ;
 
 use Carp ;
 use Exporter ;
 use Fcntl qw( :DEFAULT ) ;
 use POSIX qw( :fcntl_h ) ;
-use Symbol ;
-use UNIVERSAL ;
+use Errno ;
+#use Symbol ;
 
-use vars qw( @ISA %EXPORT_TAGS @EXPORT_OK $VERSION @EXPORT ) ;
+use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION ) ;
 @ISA = qw( Exporter ) ;
 
-%EXPORT_TAGS = ( 'all' => [
-	qw( read_file write_file overwrite_file append_file read_dir ) ] ) ;
+$VERSION = '9999.19';
 
-@EXPORT = ( @{ $EXPORT_TAGS{'all'} } );
-@EXPORT_OK = qw( slurp prepend_file ) ;
+my @std_export = qw(
+	read_file
+	write_file
+	overwrite_file
+	append_file
+	read_dir
+) ;
+
+my @edit_export = qw( 
+	edit_file
+	edit_file_lines
+) ;
+
+my @ok_export = qw( 
+) ;
 
-$VERSION = '9999.16';
+@EXPORT_OK = (
+	@edit_export,
+	qw(
+		slurp
+		prepend_file
+	),
+) ;
+
+%EXPORT_TAGS = (
+	'all'	=> [ @std_export, @edit_export, @EXPORT_OK ],
+	'edit'	=> [ @edit_export ],
+	'std'	=> [ @std_export ],
+) ;
+
+@EXPORT = @std_export ;
 
 my $max_fast_slurp_size = 1024 * 100 ;
 
@@ -82,28 +109,31 @@
 	my $file_name = shift ;
 	my $opts = ( ref $_[0] eq 'HASH' ) ? shift : { @_ } ;
 
-	if ( !ref $file_name && 0 &&
-	     -e $file_name && -s _ < $max_fast_slurp_size && ! %{$opts} && !wantarray ) {
+# this is the optimized read_file for shorter files.
+# the test for -s > 0 is to allow pseudo files to be read with the
+# regular loop since they return a size of 0.
+
+	if ( !ref $file_name && -e $file_name && -s _ > 0 &&
+	     -s _ < $max_fast_slurp_size && !%{$opts} && !wantarray ) {
 
-		local( *FH ) ;
 
-		unless( open( FH, $file_name ) ) {
+		my $fh ;
+		unless( sysopen( $fh, $file_name, O_RDONLY ) ) {
 
 			@_ = ( $opts, "read_file '$file_name' - sysopen: $!");
 			goto &_error ;
 		}
 
-		my $read_cnt = sysread( FH, my $buf, -s _ ) ;
+		my $read_cnt = sysread( $fh, my $buf, -s _ ) ;
 
 		unless ( defined $read_cnt ) {
 
-# handle the read error
-
 			@_ = ( $opts,
 				"read_file '$file_name' - small sysread: $!");
 			goto &_error ;
 		}
 
+		$buf =~ s/\015\012/\n/g if $is_win32 ;
 		return $buf ;
 	}
 
@@ -158,9 +188,8 @@
 
 #printf "RD: BINARY %x MODE %x\n", O_BINARY, $mode ;
 
-# open the file and handle any error
-
-		$read_fh = gensym ;
+		$read_fh = local( *FH ) ;
+#		$read_fh = gensym ;
 		unless ( sysopen( $read_fh, $file_name, $mode ) ) {
 			@_ = ( $opts, "read_file '$file_name' - sysopen: $!");
 			goto &_error ;
@@ -176,7 +205,6 @@
 
 #print "SIZE $size_left\n" ;
 
-
 # we need a blk_size if the size is 0 so we can handle pseudofiles like in
 # /proc. these show as 0 size but have data to be slurped.
 
@@ -187,24 +215,6 @@
 		}
 	}
 
-
-# 	if ( $size_left < 10000 && keys %{$opts} == 0 && !wantarray ) {
-
-# #print "OPT\n" and $printed++ unless $printed ;
-
-# 		my $read_cnt = sysread( $read_fh, my $buf, $size_left ) ;
-
-# 		unless ( defined $read_cnt ) {
-
-# # handle the read error
-
-# 			@_ = ( $opts, "read_file '$file_name' - small2 sysread: $!");
-# 			goto &_error ;
-# 		}
-
-# 		return $buf ;
-# 	}
-
 # infinite read loop. we exit when we are done slurping
 
 	while( 1 ) {
@@ -214,9 +224,12 @@
 		my $read_cnt = sysread( $read_fh, ${$buf_ref},
 				$size_left, length ${$buf_ref} ) ;
 
-		unless ( defined $read_cnt ) {
+# since we're using sysread Perl won't automatically restart the call
+# when interrupted by a signal.
 
-# handle the read error
+		next if $!{EINTR};
+
+		unless ( defined $read_cnt ) {
 
 			@_ = ( $opts, "read_file '$file_name' - loop sysread: $!");
 			goto &_error ;
@@ -240,9 +253,6 @@
 
 	${$buf_ref} =~ s/\015\012/\n/g if $is_win32 && !$opts->{'binmode'} ;
 
-# this is the 5 returns in a row. each handles one possible
-# combination of caller context and requested return type
-
 	my $sep = $/ ;
 	$sep = '\n\n+' if defined $sep && $sep eq '' ;
 
@@ -250,19 +260,19 @@
 
 	if( wantarray || $opts->{'array_ref'} ) {
 
-		my @parts = split m/($sep)/, ${$buf_ref}, -1;
+		use re 'taint' ;
 
-		my @lines ;
+		my @lines = length(${$buf_ref}) ?
+			${$buf_ref} =~ /(.*?$sep|.+)/sg : () ;
 
-		while( @parts > 2 ) {
+		chomp @lines if $opts->{'chomp'} ;
 
-			my( $line, $sep ) = splice( @parts, 0, 2 ) ;
-			push @lines, "$line$sep" ;
-		}
-
-		push @lines, shift @parts if @parts && length $parts[0] ;
+# caller wants an array ref
 
 		return \@lines if $opts->{'array_ref'} ;
+
+# caller wants list of lines
+
 		return @lines ;
 	}
 
@@ -277,37 +287,8 @@
 # caller passed in an i/o buffer by reference (normal void context)
 
 	return ;
-
-
-# # caller wants to get an array ref of lines
-
-# # this split doesn't work since it tries to use variable length lookbehind
-# # the m// line works.
-# #	return [ split( m|(?<=$sep)|, ${$buf_ref} ) ] if $opts->{'array_ref'}  ;
-# 	return [ length(${$buf_ref}) ? ${$buf_ref} =~ /(.*?$sep|.+)/sg : () ]
-# 		if $opts->{'array_ref'}  ;
-
-# # caller wants a list of lines (normal list context)
-
-# # same problem with this split as before.
-# #	return split( m|(?<=$sep)|, ${$buf_ref} ) if wantarray ;
-# 	return length(${$buf_ref}) ? ${$buf_ref} =~ /(.*?$sep|.+)/sg : ()
-# 		if wantarray ;
-
-# # caller wants a scalar ref to the slurped text
-
-# 	return $buf_ref if $opts->{'scalar_ref'} ;
-
-# # caller wants a scalar with the slurped text (normal scalar context)
-
-# 	return ${$buf_ref} if defined wantarray ;
-
-# # caller passed in an i/o buffer by reference (normal void context)
-
-# 	return ;
 }
 
-
 # errors in this sub are returned as scalar refs
 # a normal IO/GLOB handle is an empty return
 # an overloaded object returns its stringified as a scalarfilename
@@ -482,7 +463,8 @@
 
 # open the file and handle any error.
 
-		$write_fh = gensym ;
+		$write_fh = local( *FH ) ;
+#		$write_fh = gensym ;
 		unless ( sysopen( $write_fh, $file_name, $mode, $perms ) ) {
 
 			@_ = ( $opts, "write_file '$file_name' - sysopen: $!");
@@ -496,7 +478,6 @@
 
 	sysseek( $write_fh, 0, SEEK_END ) if $opts->{'append'} ;
 
-
 #print 'WR before data ', unpack( 'H*', ${$buf_ref}), "\n" ;
 
 # fix up newline to write cr/lf if this is a windows text file
@@ -525,14 +506,18 @@
 		my $write_cnt = syswrite( $write_fh, ${$buf_ref},
 				$size_left, $offset ) ;
 
+# since we're using syswrite Perl won't automatically restart the call
+# when interrupted by a signal.
+
+		next if $!{EINTR};
+
 		unless ( defined $write_cnt ) {
 
-# the write failed
 			@_ = ( $opts, "write_file '$file_name' - syswrite: $!");
 			goto &_error ;
 		}
 
-# track much left to write and where to write from in the buffer
+# track how much left to write and where to write from in the buffer
 
 		$size_left -= $write_cnt ;
 		$offset += $write_cnt ;
@@ -590,8 +575,6 @@
 	goto &write_file
 }
 
-# basic wrapper around opendir/readdir
-
 # prepend data to the beginning of a file
 
 sub prepend_file {
@@ -615,16 +598,11 @@
 
 #print "PRE [$prepend_data]\n" ;
 
-
-###### set croak as error_mode
-###### wrap in eval
-
 	my $err_mode = delete $opts->{err_mode} ;
 	$opts->{ err_mode } = 'croak' ;
 	$opts->{ scalar_ref } = 1 ;
 
-	my $existing_data ;
-	eval { $existing_data = read_file( $file_name, $opts ) } ;
+	my $existing_data = eval { read_file( $file_name, $opts ) } ;
 
 	if ( $@ ) {
 
@@ -635,11 +613,10 @@
 
 #print "EXIST [$$existing_data]\n" ;
 
-	$opts->{ atomic } = 1 ;
-
-	my $write_result = eval { 
-		write_file( $file_name, $opts,
-			$prepend_data, $$existing_data ) ;
+	$opts->{atomic} = 1 ;
+	my $write_result =
+		eval { write_file( $file_name, $opts,
+		       $prepend_data, $$existing_data ) ;
 	} ;
 
 	if ( $@ ) {
@@ -652,6 +629,116 @@
 	return $write_result ;
 }
 
+# edit a file as a scalar in $_
+
+sub edit_file(&$;$) {
+
+	my( $edit_code, $file_name, $opts ) = @_ ;
+	$opts = {} unless ref $opts eq 'HASH' ;
+
+# 	my $edit_code = shift ;
+# 	my $file_name = shift ;
+# 	my $opts = ( ref $_[0] eq 'HASH' ) ? shift : {} ;
+
+#print "FILE $file_name\n" ;
+
+# delete unsupported options
+
+	my @bad_opts =
+		grep $_ ne 'err_mode' && $_ ne 'binmode', keys %{$opts} ;
+
+	delete @{$opts}{@bad_opts} ;
+
+# keep the user err_mode and force croaking on internal errors
+
+	my $err_mode = delete $opts->{err_mode} ;
+	$opts->{ err_mode } = 'croak' ;
+
+# get a scalar ref for speed and slurp the file into a scalar
+
+	$opts->{ scalar_ref } = 1 ;
+	my $existing_data = eval { read_file( $file_name, $opts ) } ;
+
+	if ( $@ ) {
+
+		@_ = ( { err_mode => $err_mode },
+			"edit_file '$file_name' - read_file: $!" ) ;
+		goto &_error ;
+	}
+
+#print "EXIST [$$existing_data]\n" ;
+
+	my( $edited_data ) = map { $edit_code->(); $_ } $$existing_data ;
+
+	$opts->{atomic} = 1 ;
+	my $write_result =
+		eval { write_file( $file_name, $opts, $edited_data ) } ;
+
+	if ( $@ ) {
+
+		@_ = ( { err_mode => $err_mode },
+			"edit_file '$file_name' - write_file: $!" ) ;
+		goto &_error ;
+	}
+
+	return $write_result ;
+}
+
+sub edit_file_lines(&$;$) {
+
+	my( $edit_code, $file_name, $opts ) = @_ ;
+	$opts = {} unless ref $opts eq 'HASH' ;
+
+# 	my $edit_code = shift ;
+# 	my $file_name = shift ;
+# 	my $opts = ( ref $_[0] eq 'HASH' ) ? shift : {} ;
+
+#print "FILE $file_name\n" ;
+
+# delete unsupported options
+
+	my @bad_opts =
+		grep $_ ne 'err_mode' && $_ ne 'binmode', keys %{$opts} ;
+
+	delete @{$opts}{@bad_opts} ;
+
+# keep the user err_mode and force croaking on internal errors
+
+	my $err_mode = delete $opts->{err_mode} ;
+	$opts->{ err_mode } = 'croak' ;
+
+# get an array ref for speed and slurp the file into lines
+
+	$opts->{ array_ref } = 1 ;
+	my $existing_data = eval { read_file( $file_name, $opts ) } ;
+
+	if ( $@ ) {
+
+		@_ = ( { err_mode => $err_mode },
+			"edit_file_lines '$file_name' - read_file: $!" ) ;
+		goto &_error ;
+	}
+
+#print "EXIST [$$existing_data]\n" ;
+
+	my @edited_data = map { $edit_code->(); $_ } @$existing_data ;
+
+	$opts->{atomic} = 1 ;
+	my $write_result =
+		eval { write_file( $file_name, $opts, @edited_data ) } ;
+
+	if ( $@ ) {
+
+		@_ = ( { err_mode => $err_mode },
+			"edit_file_lines '$file_name' - write_file: $!" ) ;
+		goto &_error ;
+	}
+
+	return $write_result ;
+}
+
+# basic wrapper around opendir/readdir
+
 sub read_dir {
 
 	my $dir = shift ;
@@ -674,6 +761,11 @@
 	@dir_entries = grep( $_ ne "." && $_ ne "..", @dir_entries )
 		unless $opts->{'keep_dot_dot'} ;
 
+	if ( $opts->{'prefix'} ) {
+
+		substr( $_, 0, 0, "$dir/" ) for @dir_entries ;
+	}
+
 	return @dir_entries if wantarray ;
 	return \@dir_entries ;
 }
@@ -720,36 +812,39 @@
 
 =head1 NAME
 
-File::Slurp - Simple and Efficient Reading/Writing of Complete Files
+File::Slurp - Simple and Efficient Reading/Writing/Modifying of Complete Files
 
 =head1 SYNOPSIS
 
   use File::Slurp;
 
 # read in a whole file into a scalar
-
   my $text = read_file( 'filename' ) ;
 
 # read in a whole file into an array of lines
-
   my @lines = read_file( 'filename' ) ;
 
 # write out a whole file from a scalar
-
   write_file( 'filename', $text ) ;
 
 # write out a whole file from an array of lines
-
   write_file( 'filename', @lines ) ;
 
 # Here is a simple and fast way to load and save a simple config file
 # made of key=value lines.
+  my %conf = read_file( $file_name ) =~ /^(\w+)=(.*)$/mg ;
+  write_file( $file_name, {atomic => 1}, map "$_=$conf{$_}\n", keys %conf ) ;
 
-  my %conf = read_file( $file_name ) =~ /^(\w+)=(\.*)$/mg ;
-  write_file( $file_name, {atomic => 1}, map "$_=$conf{$_}\n", keys %conf ;
+# insert text at the beginning of a file
+  prepend_file( 'filename', $text ) ;
 
-# read in a whole directory of file names (skipping . and ..)
+# in-place edit to replace all 'foo' with 'bar' in file 
+  edit_file { s/foo/bar/g } 'filename' ;
 
+# in-place edit to delete all lines with 'foo' from file
+  edit_file_lines sub { $_ = '' if /foo/ }, 'filename' ;
+
+# read in a whole directory of file names (skipping . and ..)
   my @files = read_dir( '/path/to/dir' ) ;
 
 =head1 DESCRIPTION
@@ -803,6 +898,12 @@
 the return value and always know if you had an error. You can change how
 errors are handled with the C option.
 
+Speed Note: If you call read_file and just get a scalar return value
+it is now optimized to handle shorter files. This is only used if no
+options are used, the file is shorter then 100k bytes, the filename is
+a plain scalar and a scalar file is returned. If you want the fastest
+slurping, use the C or C options (see below)
+
 NOTE: as of version 9999.06, read_file works correctly on the C
 handle. It used to need a sysseek workaround but that is now handled
 when needed by the module itself.
@@ -831,13 +932,20 @@
 	my $lines_ref = read_file( $bin_file, array_ref => 1 ) ;
 	my $lines_ref = [ read_file( $bin_file ) ] ;
 
+=head3 chomp
+
+If this boolean option is set, the lines are chomped. This only
+happens if you are slurping in a list context or using the
+C option.
+
 =head3 scalar_ref
 
-If this boolean option is set, the return value (only in scalar context)
-will be an scalar reference to a string which is the contents of the
-slurped file. This will usually be faster than returning the plain
-scalar. It will also save memory as it will not make a copy of the file
-to return.
+If this boolean option is set, the return value (only in scalar
+context) will be an scalar reference to a string which is the contents
+of the slurped file. This will usually be faster than returning the
+plain scalar. It will also save memory as it will not make a copy of
+the file to return. Run the extras/slurp_bench.pl script to see speed
+comparisons.
 
 	my $text_ref = read_file( $bin_file, scalar_ref => 1 ) ;
 
@@ -846,7 +954,10 @@
 You can use this option to pass in a scalar reference and the slurped
 file contents will be stored in the scalar. This can be used in
 conjunction with any of the other options. This saves an extra copy of
-the slurped file and can lower ram usage vs returning the file.
+the slurped file and can lower ram usage vs returning the file. It is
+usually the fastest way to read a file into a scalar. Run the
+extras/slurp_bench.pl script to see speed comparisons.
+
 
 	read_file( $bin_file, buf_ref => \$buffer ) ;
 
@@ -1031,6 +1142,52 @@
 	prepend_file( $file, \@lines ) ;
 	prepend_file( $file, { binmode => 'raw:'}, $bin_data ) ;
 
+
+=head2 edit_file, edit_file_lines
+
+These subs read in a file into $_, execute a code block which should
+modify $_ and then write $_ back to the file. The difference between
+them is that C reads the whole file into $_ and calls the
+code block one time. With C each line is read into $_
+and the code is called for each line. In both cases the code should
+modify $_ if desired and it will be written back out. These subs are
+the equivalent of the -pi command line options of Perl but you can
+call them from inside your program and not fork out a process. They
+are in @EXPORT_OK so you need to request them to be imported on the
+use line or you can import both of them with:
+
+	use File::Slurp qw( :edit ) ;
+
+The first argument to C and C is a code
+block or a code reference. The code block is not followed by a comma
+(as with grep and map) but a code reference is followed by a
+comma. See the examples below for both styles. The next argument is
+the filename. The last argument is an optional hash reference and it
+contains key/values that can modify the behavior of
+C. 
+
+Only the C and C options are supported. The
+C call has the C option set so you will always
+have a consistant file. See above for more about those options.
+
+Each group of calls below show a Perl command line instance and the
+equivalent calls to C and C.
+
+	perl -0777 -pi -e 's/foo/bar/g' filename
+	use File::Slurp qw( edit_file ) ;
+	edit_file { s/foo/bar/g } 'filename' ;
+	edit_file sub { s/foo/bar/g }, 'filename' ;
+	edit_file \&replace_foo, 'filename' ;
+	sub replace_foo { s/foo/bar/g }
+
+	perl -pi -e '$_ = "" if /foo/' filename
+	use File::Slurp qw( edit_file_lines ) ;
+	use File::Slurp ;
+	edit_file_lines { $_ = '' if /foo/ } 'filename' ;
+	edit_file_lines sub { $_ = '' if /foo/ }, 'filename' ;
+	edit_file \&delete_foo, 'filename' ;
+	sub delete_foo { $_ = '' if /foo/ }
+
 =head2 read_dir
 
 This sub reads all the file names from directory and returns them to
@@ -1059,10 +1216,30 @@
 
 	my @all_files = read_dir( '/path/to/dir', keep_dot_dot => 1 ) ;
 
+=head3 prefix
+
+If this boolean option is set, the string "$dir/" is prefixed to each
+dir entry. This means you can directly use the results to open
+files. A common newbie mistake is not putting the directory in front
+of entries when opening themn.
+
+	my @paths = read_dir( '/path/to/dir', prefix => 1 ) ;
+
 =head2 EXPORT
 
+  These are exported by default or with
+	use File::Slurp qw( :std ) ;
+
   read_file write_file overwrite_file append_file read_dir
 
+  These are exported with
+	use File::Slurp qw( :edit ) ;
+
+  edit_file edit_file_lines
+
+  You can get all subs in the module exported with 
+	use File::Slurp qw( :all ) ;
+
 =head2 LICENSE
 
   Same as Perl.
diff -Nru libfile-slurp-perl-9999.16/MANIFEST libfile-slurp-perl-9999.19/MANIFEST
--- libfile-slurp-perl-9999.16/MANIFEST	2011-03-20 20:27:55.000000000 +0000
+++ libfile-slurp-perl-9999.19/MANIFEST	2011-05-24 05:16:12.000000000 +0000
@@ -7,8 +7,10 @@
 t/TestDriver.pm
 t/append_null.t
 t/binmode.t
+t/chomp.t
 t/data_list.t
 t/data_scalar.t
+t/edit_file.t
 t/error.t
 t/error_mode.t
 t/file_object.t
@@ -22,15 +24,15 @@
 t/perms.t
 t/pod.t
 t/pod_coverage.t
+t/prepend_file.t
 t/pseudo.t
 t/read_dir.t
+t/signal.t
 t/slurp.t
 t/stdin.t
 t/stringify.t
 t/tainted.t
 t/write_file_win32.t
-experiment/prepend.pl
-experiment/edit_file.pl
 extras/slurp_bench.pl
 extras/FileSlurp_12.pm
 extras/slurp_article.pod
diff -Nru libfile-slurp-perl-9999.16/META.yml libfile-slurp-perl-9999.19/META.yml
--- libfile-slurp-perl-9999.16/META.yml	2011-04-24 04:24:46.000000000 +0000
+++ libfile-slurp-perl-9999.19/META.yml	2011-06-07 08:06:16.000000000 +0000
@@ -1,7 +1,7 @@
 --- #YAML:1.0
 name:                File-Slurp
-version:             9999.16
-abstract:            Simple and Efficient Reading/Writing of Complete Files
+version:             9999.19
+abstract:            Simple and Efficient Reading/Writing/Modifying of Complete Files
 license:             perl
 author:              
     - Uri Guttman 
diff -Nru libfile-slurp-perl-9999.16/t/chomp.t libfile-slurp-perl-9999.19/t/chomp.t
--- libfile-slurp-perl-9999.16/t/chomp.t	1970-01-01 00:00:00.000000000 +0000
+++ libfile-slurp-perl-9999.19/t/chomp.t	2011-05-05 05:29:39.000000000 +0000
@@ -0,0 +1,53 @@
+
+use strict ;
+use warnings ;
+
+use lib qw(t) ;
+
+use File::Slurp qw( read_file write_file ) ;
+use Test::More ;
+
+use TestDriver ;
+
+my $file = 'edit_file_data' ;
+
+my $existing_data = <
 'read_file - chomp',
+		sub	=> \&read_file,
+		args	=> [
+				$file,
+				{
+					'chomp'	=> 1,
+					array_ref => 1
+				},
+		],
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+		},
+		posttest => sub {
+			my( $test ) = @_ ;
+			$test->{ok} = eq_array(
+				$test->{result},
+				[$existing_data =~ /^(.+)\n/gm]
+			) ;
+		},
+	},
+] ;
+
+test_driver( $tests ) ;
+
+unlink $file ;
+
+exit ;
diff -Nru libfile-slurp-perl-9999.16/t/edit_file.t libfile-slurp-perl-9999.19/t/edit_file.t
--- libfile-slurp-perl-9999.16/t/edit_file.t	1970-01-01 00:00:00.000000000 +0000
+++ libfile-slurp-perl-9999.19/t/edit_file.t	2011-05-21 08:01:32.000000000 +0000
@@ -0,0 +1,107 @@
+
+use strict ;
+use warnings ;
+
+use lib qw(t) ;
+
+use File::Slurp qw( :edit read_file write_file ) ;
+use Test::More ;
+
+use TestDriver ;
+
+my $file = 'edit_file_data' ;
+
+my $existing_data = <
 'edit_file - no-op',
+		sub	=> \&edit_file,
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+			$test->{args} = [
+				sub {},
+				$file
+			] ;
+			$test->{expected} = $existing_data ;
+		},
+		posttest => sub { $_[0]->{result} = read_file( $file ) },
+	},
+	{
+
+		name	=> 'edit_file - s/foo/bar/',
+		sub	=> \&edit_file,
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+			$test->{args} = [
+				sub { s/foo/bar/g },
+				$file
+			] ;
+			( $test->{expected} = $existing_data )
+				=~ s/foo/bar/g ;
+		},
+		posttest => sub { $_[0]->{result} = read_file( $file ) },
+	},
+	{
+
+		name	=> 'edit_file - upper first words',
+		sub	=> \&edit_file,
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+			$test->{args} = [
+				sub { s/^(\w+)/\U$1/gm },
+				$file
+			] ;
+			( $test->{expected} = $existing_data )
+				=~ s/^(\w+)/\U$1/gm ;
+		},
+		posttest => sub { $_[0]->{result} = read_file( $file ) },
+	},
+	{
+		name	=> 'edit_file_lines - no-op',
+		sub	=> \&edit_file_lines,
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+			$test->{args} = [
+				sub {},
+				$file
+			] ;
+			$test->{expected} = $existing_data ;
+		},
+		posttest => sub { $_[0]->{result} = read_file( $file ) },
+	},
+	{
+
+		name	=> 'edit_file - delete foo lines',
+		sub	=> \&edit_file_lines,
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+			$test->{args} = [
+				sub { $_ = '' if /foo/ },
+				$file
+			] ;
+			( $test->{expected} = $existing_data )
+				=~ s/^.*foo.*\n//gm ;
+		},
+		posttest => sub { $_[0]->{result} = read_file( $file ) },
+	},
+] ;
+
+test_driver( $tests ) ;
+
+unlink $file ;
+
+exit ;
diff -Nru libfile-slurp-perl-9999.16/t/error.t libfile-slurp-perl-9999.19/t/error.t
--- libfile-slurp-perl-9999.16/t/error.t	2011-04-16 07:59:32.000000000 +0000
+++ libfile-slurp-perl-9999.19/t/error.t	2011-05-03 08:03:02.000000000 +0000
@@ -9,7 +9,7 @@
 }
 
 use TestDriver ;
-use File::Slurp qw( :all prepend_file ) ;
+use File::Slurp qw( :all prepend_file edit_file ) ;
 
 my $is_win32 = $^O =~ /cygwin|win32/i ;
 
@@ -87,7 +87,36 @@
 		error	=> qr/write_file/,
 		posttest => sub { unlink $file_name, "$file_name.$$" },
 	},
-
+	{
+		name	=> 'edit_file read error',
+		sub	=> \&edit_file,
+		args	=> [ sub{}, $file_name ],
+		error	=> qr/read_file/,
+	},
+	{
+		name	=> 'edit_file write error',
+		sub	=> \&edit_file,
+		pretest	=> sub { write_file( $file_name, '' ) },
+		args	=> [ sub{}, $file_name ],
+		override => 'syswrite',
+		error	=> qr/write_file/,
+		posttest => sub { unlink $file_name, "$file_name.$$" },
+	},
+	{
+		name	=> 'edit_file_lines read error',
+		sub	=> \&edit_file_lines,
+		args	=> [ sub{}, $file_name ],
+		error	=> qr/read_file/,
+	},
+	{
+		name	=> 'edit_file_lines write error',
+		sub	=> \&edit_file_lines,
+		pretest	=> sub { write_file( $file_name, '' ) },
+		args	=> [ sub{}, $file_name ],
+		override => 'syswrite',
+		error	=> qr/write_file/,
+		posttest => sub { unlink $file_name, "$file_name.$$" },
+	},
 ] ;
 
 test_driver( $tests ) ;
diff -Nru libfile-slurp-perl-9999.16/t/inode.t libfile-slurp-perl-9999.19/t/inode.t
--- libfile-slurp-perl-9999.16/t/inode.t	2009-05-01 00:20:30.000000000 +0000
+++ libfile-slurp-perl-9999.19/t/inode.t	2011-05-25 03:50:13.000000000 +0000
@@ -9,16 +9,13 @@
 use Symbol ;
 use Test::More ;
 
-
-BEGIN{ 
-
+BEGIN { 
 	if( $^O =~ '32' ) {
 		plan skip_all => 'skip inode test on windows';
 		exit ;
 	}
-	else {
-		plan tests => 2 ;
-	}
+
+	plan tests => 2 ;
 }
 
 my $data = <
-	'Test::Pod 1.14 required for testing PODe' if $@ ;
+	'Test::Pod 1.14 required for testing POD' if $@ ;
 
 all_pod_files_ok(
 # 	{
diff -Nru libfile-slurp-perl-9999.16/t/prepend_file.t libfile-slurp-perl-9999.19/t/prepend_file.t
--- libfile-slurp-perl-9999.16/t/prepend_file.t	1970-01-01 00:00:00.000000000 +0000
+++ libfile-slurp-perl-9999.19/t/prepend_file.t	2011-04-16 07:19:17.000000000 +0000
@@ -0,0 +1,74 @@
+
+use strict ;
+use warnings ;
+
+use lib qw(t) ;
+
+use File::Slurp qw( read_file write_file prepend_file ) ;
+use Test::More ;
+
+use TestDriver ;
+
+my $file = 'prepend_file' ;
+my $existing_data = <
 'prepend null',
+		sub	=> \&prepend_file,
+		prepend_data	=> '',
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+			my $prepend_data = $test->{prepend_data} ;
+			$test->{args} = [
+				$file,
+				$prepend_data,
+			] ;
+			$test->{expected} = "$prepend_data$existing_data" ;
+		},
+		posttest => sub { $_[0]->{result} = read_file( $file ) },
+	},
+	{
+		name	=> 'prepend line',
+		sub	=> \&prepend_file,
+		prepend_data => "line 0\n",
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+			my $prepend_data = $test->{prepend_data} ;
+			$test->{args} = [
+				$file,
+				$prepend_data,
+			] ;
+			$test->{expected} = "$prepend_data$existing_data" ;
+		},
+		posttest => sub { $_[0]->{result} = read_file( $file ) },
+	},
+	{
+		name	=> 'prepend partial line',
+		sub	=> \&prepend_file,
+		prepend_data => 'partial line',
+		pretest	=> sub {
+			my( $test ) = @_ ;
+			write_file( $file, $existing_data ) ;
+			my $prepend_data = $test->{prepend_data} ;
+			$test->{args} = [
+				$file,
+				$prepend_data,
+			] ;
+			$test->{expected} = "$prepend_data$existing_data" ;
+		},
+		posttest => sub { $_[0]->{result} = read_file( $file ) },
+	},
+] ;
+
+test_driver( $tests ) ;
+
+unlink $file ;
+
+exit ;
diff -Nru libfile-slurp-perl-9999.16/t/read_dir.t libfile-slurp-perl-9999.19/t/read_dir.t
--- libfile-slurp-perl-9999.16/t/read_dir.t	2011-04-16 07:14:56.000000000 +0000
+++ libfile-slurp-perl-9999.19/t/read_dir.t	2011-05-05 05:18:08.000000000 +0000
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w -I.
 
 use strict ;
-use Test::More tests => 8 ;
+use Test::More tests => 9 ;
 
 use File::Slurp ;
 
@@ -52,6 +52,11 @@
 ok( eq_array( $dir_entries_ref, \@expected_entries ),
 	"dir in array ref" ) ;
 
+my @prefixed_entries = read_dir( $test_dir, {prefix => 1} ) ;
+@prefixed_entries = sort @prefixed_entries ;
+ok( eq_array( \@prefixed_entries, [map "$test_dir/$_", @dir_entries] ),
+	'prefix option' ) ;
+
 # clean up
 
 unlink map "$test_dir/$_", @dir_entries ;
diff -Nru libfile-slurp-perl-9999.16/t/signal.t libfile-slurp-perl-9999.19/t/signal.t
--- libfile-slurp-perl-9999.16/t/signal.t	1970-01-01 00:00:00.000000000 +0000
+++ libfile-slurp-perl-9999.19/t/signal.t	2011-06-07 08:05:31.000000000 +0000
@@ -0,0 +1,34 @@
+#!/usr/local/bin/perl -w
+
+use strict ;
+use File::Slurp qw(read_file);
+
+use Carp ;
+use Test::More ;
+
+BEGIN { 
+	if( $^O =~ '32' ) {
+		plan skip_all => 'skip signal test on windows';
+		exit ;
+	}
+
+	plan tests => 1 ;
+}
+
+$SIG{CHLD} = sub {};
+
+pipe(IN, OUT);
+
+print "forking\n";
+if (!fork) {
+   sleep 1;
+   exit;
+} 
+if (!fork) {
+   sleep 2;
+   print OUT "success";
+   exit;
+}
+close OUT;
+my $data = read_file(\*IN);
+is ($data, "success", "handle EINTR failed");
diff -Nru libfile-slurp-perl-9999.16/t/TestDriver.pm libfile-slurp-perl-9999.19/t/TestDriver.pm
--- libfile-slurp-perl-9999.16/t/TestDriver.pm	2011-04-16 07:57:43.000000000 +0000
+++ libfile-slurp-perl-9999.19/t/TestDriver.pm	2011-05-05 01:04:56.000000000 +0000
@@ -4,16 +4,19 @@
 
 BEGIN {
 	*CORE::GLOBAL::syswrite =
-	sub(*\$$;$) { my( $h, $b, $s ) = @_; CORE::syswrite $h, $b, $s } ;
+	sub($$$;$) { my( $h, $b, $s, $o ) = @_; CORE::syswrite $h, $b, $s, $o} ;
+#	sub(*\$$;$) { my( $h, $b, $s, $o ) = @_; CORE::syswrite $h, $b, $s, $o } ;
 
 	*CORE::GLOBAL::sysread =
-	sub(*\$$;$) { my( $h, $b, $s ) = @_; CORE::sysread $h, $b, $s } ;
+	sub($$$;$) { my( $h, $b, $s, $o ) = @_; CORE::sysread $h, $b, $s, $o } ;
+#	sub(*\$$;$) { my( $h, $b, $s, $o ) = @_; CORE::sysread $h, $b, $s, $o } ;
 
 	*CORE::GLOBAL::rename =
 	sub($$) { my( $old, $new ) = @_; CORE::rename $old, $new } ;
 
 	*CORE::GLOBAL::sysopen =
-	sub(*$$;$) { my( $h, $n, $m, $p ) = @_; CORE::sysopen $h, $n, $m, $p } ;
+	sub($$$;$) { my( $h, $n, $m, $p ) = @_; CORE::sysopen $h, $n, $m, $p } ;
+#	sub(*$$;$) { my( $h, $n, $m, $p ) = @_; CORE::sysopen $h, $n, $m, $p } ;
 }
 
 sub test_driver {