[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 19991228.007] [PATCH _63] Slurping empty files



Gurusamy Sarathy wrote:

> I think your patch effectively does:

> -      || (IoFLAGS(io) & IOf_NOLINE) || IoLINES(io) || !RsSNARF(rs))	\
> +      || (IoFLAGS(io) & IOf_NOLINE) || !RsSNARF(rs))	\

> Any reason why we can't do just the above?

That would change behaviour: in _03, if you read a number
of lines with a defined $/ and then slurp the rest of the
file, you get undef if the rest happens to be 0 bytes long.
With your change, you'd get a defined empty string.

I think that this would be an improvement as it would be more
consistent with the behaviour for empty files.  But we may have
to explain the issue to the Backward Compatibility Police.

And I think we also want to do

+    IoFLAGS(io) &= ~IOf_NOLINE;

somewhere near the end of Perl_do_open9().

-- HansM


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]