[Catalyst-commits] r6371 - in trunk/Catalyst-Model-DBI: .
lib/Catalyst/Model
alex at dev.catalyst.perl.org
alex at dev.catalyst.perl.org
Mon May 7 16:59:04 GMT 2007
Author: alex
Date: 2007-05-07 16:58:53 +0100 (Mon, 07 May 2007)
New Revision: 6371
Modified:
trunk/Catalyst-Model-DBI/Changes
trunk/Catalyst-Model-DBI/lib/Catalyst/Model/DBI.pm
Log:
made ->_pid(4152) non lazy, fixed a few things
Modified: trunk/Catalyst-Model-DBI/Changes
===================================================================
--- trunk/Catalyst-Model-DBI/Changes 2007-05-07 07:47:53 UTC (rev 6370)
+++ trunk/Catalyst-Model-DBI/Changes 2007-05-07 15:58:53 UTC (rev 6371)
@@ -1,4 +1,6 @@
Revision history for Perl extension Catalyst::Model::DBI.
+0.17 Mon May 07 08:00:00 2007
+ - made $self->_pid($$) "non lazy", fixed a few things
0.16 Sun May 06 14:48:00 2007
- added fix to support ACCEPT_CONTEXT as per issue brought up by Evan Caroll
0.15 Sun Dec 10 23:00:00 2006
Modified: trunk/Catalyst-Model-DBI/lib/Catalyst/Model/DBI.pm
===================================================================
--- trunk/Catalyst-Model-DBI/lib/Catalyst/Model/DBI.pm 2007-05-07 07:47:53 UTC (rev 6370)
+++ trunk/Catalyst-Model-DBI/lib/Catalyst/Model/DBI.pm 2007-05-07 15:58:53 UTC (rev 6371)
@@ -5,7 +5,7 @@
use NEXT;
use DBI;
-our $VERSION = '0.16';
+our $VERSION = '0.17';
__PACKAGE__->mk_accessors( qw/_dbh _pid _tid/ );
@@ -57,6 +57,7 @@
$self->{additional_base_classes} ||= ();
$self->{log} = $c->log;
$self->{debug} = $c->debug;
+ $self->_pid ( $$ );
my $dbh;
$self->{__dbh} = \$dbh;
return $self;
@@ -68,17 +69,18 @@
sub stay_connected {
my $self = shift;
+ $self->_dbh( ${$self->{__dbh}} );
if ( $self->_dbh ) {
- if ( defined $self->_tid && $self->_tid != threads->tid ) {
- $self->_dbh ( $self->connect );
+ if ( $self->_tid && threads->tid && $self->_tid != threads->tid ) {
+ $self->_dbh( $self->connect );
} elsif ( $self->_pid != $$ ) {
$self->_dbh->{InactiveDestroy} = 1;
- $self->_dbh ( $self->connect );
+ $self->_dbh( $self->connect );
} elsif ( ! $self->connected ) {
- $self->_dbh ( $self->connect );
+ $self->_dbh( $self->connect );
}
} else {
- $self->_dbh ( $self->connect );
+ $self->_dbh( $self->connect );
}
${$self->{__dbh}} = $self->_dbh;
return $self->_dbh;
@@ -103,6 +105,7 @@
if ($@) { $self->{log}->debug( qq{Couldn't connect to the database "$@"} ) if $self->{debug} }
else { $self->{log}->debug ( 'Connected to the database via dsn:' . $self->{dsn} ) if $self->{debug}; }
$self->_pid ( $$ );
+ $self->{__pid} = $$;
$self->_tid ( threads->tid ) if $INC{'threads.pm'};
return $dbh;
}
More information about the Catalyst-commits
mailing list