Revision history for MooseX-Storage
+0.02
+ * MooseX::Storage::Engine
+ - better error reporting when cycles are found
+
0.01 Mon. April 30, 2007
This was Chris's idea originally (blame him), and
we expanded on it to create what you see here :)
package MooseX::Storage::Engine;
use Moose;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
# the class marker when
# serializing an object.
# this might not be enough, we might
# need to make it possible for the
# cycle checker to return the value
- $self->check_for_cycle_in_collapse($value)
+ $self->check_for_cycle_in_collapse($attr, $value)
if ref $value;
if (defined $value && $attr->has_type_constraint) {
# NOTE:
# (see comment in method above ^^)
- $self->check_for_cycle_in_expansion($value)
+ $self->check_for_cycle_in_expansion($attr, $value)
if ref $value;
if (defined $value && $attr->has_type_constraint) {
# anyway.
sub check_for_cycle_in_collapse {
- my ($self, $value) = @_;
+ my ($self, $attr, $value) = @_;
(!exists $self->seen->{$value})
- || confess "Basic Engine does not support cycles";
+ || confess "Basic Engine does not support cycles in class("
+ . ($attr->associated_metaclass->name) . ").attr("
+ . ($attr->name) . ") with $value";
$self->seen->{$value} = undef;
}
sub check_for_cycle_in_expansion {
- my ($self, $value) = @_;
+ my ($self, $attr, $value) = @_;
(!exists $self->seen->{$value})
- || confess "Basic Engine does not support cycles";
+ || confess "Basic Engine does not support cycles in class("
+ . ($attr->associated_metaclass->name) . ").attr("
+ . ($attr->name) . ") with $value";
$self->seen->{$value} = undef;
}