[Bast-commits] r7498 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class
lib/DBIx/Class/Serialize lib/DBIx/Class/Storage
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Thu Sep 3 09:11:50 GMT 2009
Author: ribasushi
Date: 2009-09-03 09:11:50 +0000 (Thu, 03 Sep 2009)
New Revision: 7498
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSourceHandle.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Serialize/Storable.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
Log:
Storable sanification
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2009-09-03 09:11:29 UTC (rev 7497)
+++ DBIx-Class/0.08/trunk/Changes 2009-09-03 09:11:50 UTC (rev 7498)
@@ -5,9 +5,13 @@
- Fixed a complex prefetch + regular join regression introduced
in 0.08108
- Fixed insert_bulk rebless handling
+ - Fixed Storable roundtrip regression, and general serialization
+ cleanup
- SQLT related fixes:
- sqlt_type is now called on the correct storage object
- hooks can now see the correct producer_type
+ - optional SQLT requirements for e.g. deploy() bumped to 0.11002
+ - Automatically detect MySQL v3 and use INNER JOIN instead of JOIN
- POD improvements
0.08109 2009-08-18 08:35:00 (UTC)
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2009-09-03 09:11:29 UTC (rev 7497)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2009-09-03 09:11:50 UTC (rev 7498)
@@ -6,7 +6,6 @@
use DBIx::Class::ResultSet;
use DBIx::Class::ResultSourceHandle;
use Carp::Clan qw/^DBIx::Class/;
-use Storable;
use base qw/DBIx::Class/;
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSourceHandle.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSourceHandle.pm 2009-09-03 09:11:29 UTC (rev 7497)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSourceHandle.pm 2009-09-03 09:11:50 UTC (rev 7498)
@@ -78,8 +78,9 @@
my $to_serialize = { %$self };
- my $class = $self->schema->class($self->source_moniker);
- $to_serialize->{schema} = $class;
+ delete $to_serialize->{schema};
+ $to_serialize->{_frozen_from_class} = $self->schema->class($self->source_moniker);
+
return (Storable::freeze($to_serialize));
}
@@ -93,10 +94,10 @@
sub STORABLE_thaw {
- my ($self, $cloning,$ice) = @_;
+ my ($self, $cloning, $ice) = @_;
%$self = %{ Storable::thaw($ice) };
- my $class = delete $self->{schema};
+ my $class = delete $self->{_frozen_from_class};
if( $thaw_schema ) {
$self->{schema} = $thaw_schema;
}
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Serialize/Storable.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Serialize/Storable.pm 2009-09-03 09:11:29 UTC (rev 7497)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Serialize/Storable.pm 2009-09-03 09:11:50 UTC (rev 7498)
@@ -7,10 +7,18 @@
my ($self, $cloning) = @_;
my $to_serialize = { %$self };
+ # The source is either derived from _source_handle or is
+ # reattached in the thaw handler below
delete $to_serialize->{result_source};
- delete $to_serialize->{related_resultsets};
- delete $to_serialize->{_inflated_column};
+ # If the parser is cached there is a chance that the interpeter
+ # which receives the ice will not have the parser loaded
+ # A re-determination will force an implicit load
+ delete $to_serialize->{__datetime_parser};
+
+ # Dynamic values, easy to recalculate
+ delete $to_serialize->{$_} for qw/related_resultsets _inflated_column/;
+
return (Storable::freeze($to_serialize));
}
@@ -18,8 +26,10 @@
my ($self, $cloning, $serialized) = @_;
%$self = %{ Storable::thaw($serialized) };
+
+ # if the handle went missing somehow, reattach
$self->result_source($self->result_source_instance)
- if $self->can('result_source_instance');
+ if !$self->_source_handle && $self->can('result_source_instance');
}
1;
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2009-09-03 09:11:29 UTC (rev 7497)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2009-09-03 09:11:50 UTC (rev 7498)
@@ -2515,8 +2515,7 @@
sub build_datetime_parser {
my $self = shift;
my $type = $self->datetime_parser_type(@_);
- eval "use ${type}";
- $self->throw_exception("Couldn't load ${type}: $@") if $@;
+ $self->ensure_class_loaded ($type);
return $type;
}
More information about the Bast-commits
mailing list