From: Uri Guttman Date: Fri, 5 Jun 2009 05:13:35 +0000 (-0400) Subject: uncommented code to set $blk_size and $size_left if the size is 0. this X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9940db733823ad4aa507ed2d7b5720b4e5ae32f;p=urisagit%2FPerl-Docs.git uncommented code to set $blk_size and $size_left if the size is 0. this is to handle pseudofiles which show a size of 0 but have data to slurp. --- diff --git a/lib/File/Slurp.pm b/lib/File/Slurp.pm index f4b9138..1d043c3 100755 --- a/lib/File/Slurp.pm +++ b/lib/File/Slurp.pm @@ -170,17 +170,17 @@ ERR $size_left = -s $read_fh ; -print "SIZE $size_left\n" ; +#print "SIZE $size_left\n" ; -### TEST -# blk_size is not needed if we have a real file size > 0. for 0 size who cares? -# so test this deletion -### -# unless( $size_left ) { -# $blk_size = $args{'blk_size'} || 1024 * 1024 ; -# $size_left = $blk_size ; -# } +# 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. + + unless( $size_left ) { + + $blk_size = $args{'blk_size'} || 1024 * 1024 ; + $size_left = $blk_size ; + } }