Exception::Class::DBI

DBI Exception objects
Download

Exception::Class::DBI Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • David E. Wheeler
  • Publisher web site:
  • http://search.cpan.org/~dwheeler/

Exception::Class::DBI Tags


Exception::Class::DBI Description

DBI Exception objects Exception::Class::DBI is a Perl module that offers a set of DBI-specific exception classes. They inherit from Exception::Class, the base class for all exception objects created by the Exception::Class module from the CPAN. Exception::Class::DBI itself offers a single class method, handler(), that returns a code reference appropriate for passing to the DBI HandleError attribute.The exception classes created by Exception::Class::DBI are designed to be thrown in certain DBI contexts; the code reference returned by handler() and passed to the DBI HandleError attribute determines the context and throws the appropriate exception.Each of the Exception::Class::DBI classes offers a set of object accessor methods in addition to those provided by Exception::Class. These can be used to output detailed diagnostic information in the event of an exception.Synopsis use DBI; use Exception::Class::DBI; my $dbh = DBI->connect($dsn, $user, $pass, { PrintError => 0, RaiseError => 0, HandleError => Exception::Class::DBI->handler, }); eval { $dbh->do($sql) }; if (my $ex = $@) { print STDERR "DBI Exception:\n"; print STDERR " Exception Type: ", ref $ex, "\n"; print STDERR " Error: ", $ex->error, "\n"; print STDERR " Err: ", $ex->err, "\n"; print STDERR " Errstr: ", $ex->errstr, "\n"; print STDERR " State: ", $ex->state, "\n"; print STDERR " Return Value: ", ($ex->retval || 'undef'), "\n"; } Requirements: · Perl


Exception::Class::DBI Related Software