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 @[EMAIL PROTECTED] -231,7 +231,18 @[EMAIL PROTECTED] my ($self, $keyref) = @[EMAIL PROTECTED] 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 ($@[EMAIL PROTECTED] ) { + my $context = $self->{context}; + $context->log("WARNING: DataStore($self->{name})->get_ref($hashkey): $@[EMAIL PROTECTED] "); + } + } &App::sub_exit($valueref) if ($App::trace); return($valueref); } @[EMAIL PROTECTED] -315,7 +326,7 @[EMAIL PROTECTED] * Return: $keyref any (ref or scalar) * Return: $hashkey scalar - $hashkey = $sds->deserialize($keyref); + $hashkey = $sds->hashkey($keyref); =cut