Class::ReluctantORM::Exception - OO Exceptions
use Class::ReluctantORM::Exception; # In API code: # dies locally Class::ReluctantORM::Exception::Params::Missing->throw(param => 'id'); # dies from caller's perspective Class::ReluctantORM::Exception::Params::Missing->croak(param => 'id'); # dies from caller's caller's perspective Class::ReluctantORM::Exception::Params::Missing->croak(param => 'id', frames => 2); # To catch: eval { something_dangerous(); } if (my $e = Class::ReluctantORM::Exception::Params::Missing->caught()) { my $p = $e->param(); # Find out what was missing print $e; # Stringifies nicely } else { die $@; # Pass on unrecognized exceptions } # Special handler included for working with OmniTI::DB connections.... my $dbh = NatGeo::DB::Magazine->new(); $dbh->set_handle_error(Class::ReluctantORM::Exception->make_db_error_handler());
Uses Exception::Class to define a wide variety of exceptions.
Any extra fields defined for a particular exception class will be included in the stringification of the exception, like this:
Error message field1 => value1 field2 => value2
Exceptions related to parameter passing. Expect fields 'param'.
An array or hash ref turned out to be present but empty.
Thrown when the method uses named parameters, but an odd number of parameters were provided. param field is not used.
Used when two parameters cannot both be present. Use fields 'param' and 'other_param'.
Thrown when the same named parameter is used more than once.
Clinton Wolfe
To install Class::ReluctantORM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::ReluctantORM
CPAN shell
perl -MCPAN -e shell install Class::ReluctantORM
For more information on module installation, please visit the detailed CPAN module installation guide.