common: slurp() learns to look at wantarray

This commit is contained in:
Sitaram Chamarty 2012-03-11 20:46:31 +05:30
parent c19f75e119
commit ef476f0d32

View file

@ -127,7 +127,8 @@ sub _print {
}
sub slurp {
local $/ = undef;
return unless defined wantarray;
local $/ = undef unless wantarray;
my $fh = _open( "<", $_[0] );
return <$fh>;
}