From: Stevan Little Date: Fri, 4 May 2007 19:21:57 +0000 (+0000) Subject: * changes for MooseX::IOC X-Git-Tag: 0_02~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=45d9a73cb319d9cd4d3e30d07526d72cb3e11ad2;p=gitmo%2FMooseX-Storage.git * changes for MooseX::IOC * fixes in the MooseX::AttributeHelpers * better errors in MooseX::Storage --- diff --git a/Changes b/Changes index 9e39cc1..629c2f3 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ 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 :) diff --git a/README b/README index f4dcf91..e8a2a3e 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -MooseX-Storage version 0.01 +MooseX-Storage version 0.02 INSTALLATION diff --git a/lib/MooseX/Storage.pm b/lib/MooseX/Storage.pm index 9585e5f..6d7f6e3 100644 --- a/lib/MooseX/Storage.pm +++ b/lib/MooseX/Storage.pm @@ -4,7 +4,7 @@ use Moose qw(confess); use MooseX::Storage::Meta::Attribute::DoNotSerialize; -our $VERSION = '0.01'; +our $VERSION = '0.02'; sub import { my $pkg = caller(); diff --git a/lib/MooseX/Storage/Engine.pm b/lib/MooseX/Storage/Engine.pm index 50294c2..ec96c70 100644 --- a/lib/MooseX/Storage/Engine.pm +++ b/lib/MooseX/Storage/Engine.pm @@ -2,7 +2,7 @@ package MooseX::Storage::Engine; use Moose; -our $VERSION = '0.01'; +our $VERSION = '0.02'; # the class marker when # serializing an object. @@ -68,7 +68,7 @@ sub collapse_attribute_value { # 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) { @@ -85,7 +85,7 @@ sub expand_attribute_value { # 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) { @@ -103,16 +103,20 @@ sub expand_attribute_value { # 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; }