common: slurp() learns to look at wantarray
This commit is contained in:
parent
c19f75e119
commit
ef476f0d32
|
@ -127,7 +127,8 @@ sub _print {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub slurp {
|
sub slurp {
|
||||||
local $/ = undef;
|
return unless defined wantarray;
|
||||||
|
local $/ = undef unless wantarray;
|
||||||
my $fh = _open( "<", $_[0] );
|
my $fh = _open( "<", $_[0] );
|
||||||
return <$fh>;
|
return <$fh>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue