Hi Jason,

The original perl exception handling is pretty primitive.  There are many CPAN modules that expand on it 
but we've been slow to add them.  Even moving to perl 5.10 broke some redhat RHE5  installations (perl is updated very slowly 
in those distributions). (current version is about 5.18 , macs --also slow --  have 5.12 installed, )  

The simple native way to do a  primitive try/catch block is to use the curly bracket form of eval (which as I understand it is actually 
evaluated at compile time).

eval { 

here is your try block 
  use die to throw an error message.
}
if $@ {
    the error message is in $@ if something was thrown.

}

There are CPAN modules of various levels of sophistication that bring perl up to date with respect to 
exception handling.

I think the module  Try::Tiny  might be something that we could add without breaking current 
installations but that would also make exception handling less arcane.  
There is also an Exception class CPAN module which we should consider requiring. 

Eventually I'd like to move things toward using Modern Perl so that we can use more modern language
constructions but we can't move too quickly as long as people are still using perl 5.8 

Take care,

Mike

On Oct 23, 2013, at 9:49 AM, Jason Grout <notifications@github.com> wrote:

> I was really trying to do a try/catch block. Somewhere online it said I could do it this way. Would an if/else work too? I don't know how exceptions and errors work in perl.