From: gfx Date: Mon, 19 Oct 2009 05:15:43 +0000 (+0900) Subject: Ignore fatal errors in "traits" resolution. This is a temporary change. X-Git-Tag: 0.40~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=341a3046743c9d5dc1d83c9ef878e9a9bb190587;p=gitmo%2FMouse.git Ignore fatal errors in "traits" resolution. This is a temporary change. --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 2d75d0e..71a2bbd 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -214,17 +214,21 @@ sub interpolate_class{ my @traits; if(my $traits_ref = delete $args->{traits}){ - for (my $i = 0; $i < @{$traits_ref}; $i++) { - my $trait = Mouse::Util::resolve_metaclass_alias(Attribute => $traits_ref->[$i], trait => 1); + local $@; + eval{ + for (my $i = 0; $i < @{$traits_ref}; $i++) { + my $trait = Mouse::Util::resolve_metaclass_alias(Attribute => $traits_ref->[$i], trait => 1); - next if $class->does($trait); + next if $class->does($trait); - push @traits, $trait; + push @traits, $trait; - # are there options? - push @traits, $traits_ref->[++$i] - if ref($traits_ref->[$i+1]); - } + # are there options? + push @traits, $traits_ref->[++$i] + if ref($traits_ref->[$i+1]); + } + }; + warn "Fatal error in traits: $@" if _MOUSE_VERBOSE; if (@traits) { $class = Mouse::Meta::Class->create_anon_class(