[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Python or Perl for a Debian maintainance project?

On Thu, Feb 19, 2004 at 10:53:31AM -0800, Matt Zimmerman wrote:
> 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.

Look at the Error and Exception::Class modules.

It's rare because in perl, you *very* rarely need anything as complex
as a full exception. Most of the time you don't need exceptions at all
- return values are quite adequete (because (a) you can return any
arbitrarily complicated object, and (b) you have undef for error

It's not that the tools aren't well developed, it's that they aren't
needed most of the time.

  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature

Reply to: