Re: Python or Perl for a Debian maintainance project?
On Thu, Feb 19, 2004 at 01:21:23PM -0500, Joey Hess wrote:
> Matt Zimmerman wrote:
> > The principal difference being that $@ is a string, while the exception
> > raised in Matthias' is a real exception. This means that various error
> > conditions can be handled programmatically, rather than aborting with an
> > error message.
>
> $@ can be an exception object if you want it to be.
I found exactly zero occurrences of this practice in the standard Perl
library and all modules I have installed on my system, and perlvar(1) says
it is a string, so I imagine this techinque is not very popular. Have you
ever used it? Standardized error handling is a lot less interesting if the
"standard" is limited to code that you write yourself.
> perldoc -f die
<shields eyes>
If LIST is empty and $@ already contains a value (typically
from a previous eval) that value is reused after appending
"\t...propagated". This is useful for propagating exceptions:
eval { ... };
die unless $@ =~ /Expected exception/;
--
- mdz
Reply to: