At 10:11 AM 8/17/00 -0700, Larry Wall wrote:
>Peter Scott writes:
>: Do we want to come up with any modifications to the scope of $! (I'm not
>: talking about the dual string-number nature)? I've occasionally been
>: flummoxed by looking at it when there hadn't really been an error (but it's
>: set anyway, randomly it seems); or calling some module method that failed
>: and then wondering whether $! tells me anything useful or not (did the
>: method make a failed system call?).
>:
>: I realize this is very pedestrian compared to the exception-handling stuff
>: we've been tossing around, which could largely be said to render the issue
>: moot; but I thought I'd shake the branches anyway and see what fell out.
>
>At minimum we could lexically scope $! to the current file. I would hate
>to lose the notational convenience of $!.
Well, I wasn't thinking of doing away with it (although there are other
proposals that would probably have that effect). I just wanted to make it
more useful. There are loads of times that I call out to something and it
fails, and I never know whether $! will tell me something or not. Suppose
I get a new Net::POP3 handle but I get undef instead. Will $! tell me
anything about why? Maybe, if there was a bad socket call... maybe
not. But as far as I'm concerned, a system call failed (where 'system' is
just some piece of underlying infrastructure). Having to know the
difference between those and functions from section 2 of the Unix manual is
onerous; I keep expecting $! to be a generic sideband error notification
thingy.
Is it worth trying to do that?
--
Peter Scott
Pacific Systems Design Technologies