Author: spadkins
Date: Thu Feb 28 11:50:01 2008
New Revision: 10851
Modified:
p5ee/trunk/App-Context/lib/App/SharedDatastore.pm
Log:
protect against varying versions of Storable which may cause deserialization
exceptions
Modified: p5ee/trunk/App-Context/lib/App/SharedDatastore.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/SharedDatastore.pm (original)
+++ p5ee/trunk/App-Context/lib/App/SharedDatastore.pm Thu Feb 28 11:50:01 2008
@@ -231,7 +231,18 @@
my ($self, $keyref) = @_;
my $hashkey = $self->hashkey($keyref);
my $blob = $self->get($hashkey);
- my $valueref = (defined $blob) ? $self->deserialize($blob) : undef;
+ my ($valueref);
+ if (defined $blob) {
+ eval {
+ $valueref = $self->deserialize($blob);
+ };
+ # we want to catch errors in derialization which may occur due to
version mismatches in the Storable module
+ # (see "man Storable" in section on "FORWARD COMPATIBILITY")
+ if ($@) {
+ my $context = $self->{context};
+ $context->log("WARNING:
DataStore($self->{name})->get_ref($hashkey): $@");
+ }
+ }
&App::sub_exit($valueref) if ($App::trace);
return($valueref);
}
@@ -315,7 +326,7 @@
* Return: $keyref any (ref or scalar)
* Return: $hashkey scalar
- $hashkey = $sds->deserialize($keyref);
+ $hashkey = $sds->hashkey($keyref);
=cut