"Real" Exceptions
- Before Perl 5.005, $@ could only be a string
- If you passed a ref to die(), it was stringified
- Since 5.005, if you pass a ref, it is stored as is
- So now we can do this:
eval { die { error => 'Bad SQL',
sql => $sql,
bound_vars => \@bound_vars } };
if ($@)
{
warn "Error: $@->{error}\n";
warn "SQL: $@->{sql}\n" if exists $@->{sql};
}