Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: DBIx::Class connection

by Khen1950fx (Canon)
on Jan 03, 2011 at 09:16 UTC ( #880155=note: print w/replies, xml ) Need Help??

in reply to DBIx::Class connection

I took Your Mother's example and added DBIx::QueryByName::Logger and DBIx::Connector. DBIx::Connector will automatically take care of reconnecting your $dbh. All you have to do is worry about exceptions. If you have Log::Log4perl, then DBIx::QueryByName::Logger will use its get_logger method and utilize Log::Log4perl.
package My::Schema; use strict; use warnings; use base qw/DBIx::Class::Schema/; use DBIx::Connector; use DBIx::QueryByName::Logger; __PACKAGE__->load_classes; my $dsn; my $username; my $password; my %attr; my %extr; my $schema = My::Schema->connect( sub { my $conn = DBI::Connector->new( $dsn, $username, $password, \%attr, \%extr); my $dbh = $conn->dbh; $conn->run( fixup => sub { my $log; &$_->($log = get_logger()); }); });

Replies are listed 'Best First'.
Re^2: DBIx::Class connection
by Anonymous Monk on Mar 24, 2013 at 21:55 UTC
    DBI::Connector->new or DBIx::Connector->new

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://880155]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-06-23 14:43 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.