On Thu, Oct 30, 2008 at 12:49:48PM +0100, Vincent Lefevre wrote:
> On 2008-10-30 13:24:10 +0200, Niko Tyni wrote:
> > I don't think this is a bug. As documented in perlvar.pod,
> > the value $! is meaningful only immediately after a failure.
> 
> The problem with the readline function is that one cannot know
> if there's a failure without looking at $! first! Note that the
> example tests whether the returned value is defined, but undef
> in case of end of file isn't a failure. But what if the result
> is not undef (in either scalar or list context) while there's a
> failure?

My understanding is that this can't happen: a failure guarantees that
the result is undef, but getting an undefined result does not guarantee
there was a failure (you have to test $! additionally).

The example in 'perldoc -f readline' does this, but your example
script doesn't.
 
> So, either the behavior or the documentation has to be changed.

Yes, I agree the readline documentation could be more explicit about this.
-- 
Niko Tyni   [EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to