From: Shawn M Moore Date: Sun, 26 Apr 2009 00:41:45 +0000 (-0400) Subject: Improve robustness X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c140dc59bfb4b4b8d90d9c991d18f4135b5974ae;p=gitmo%2FPerl-Critic-Dynamic-Moose.git Improve robustness --- diff --git a/lib/Perl/Critic/Policy/Dynamic/Moose.pm b/lib/Perl/Critic/Policy/Dynamic/Moose.pm index a50cebe..e675b45 100644 --- a/lib/Perl/Critic/Policy/Dynamic/Moose.pm +++ b/lib/Perl/Critic/Policy/Dynamic/Moose.pm @@ -32,8 +32,11 @@ sub violates_dynamic { my @violations; for my $package (@packages) { - my $meta = Class::MOP::class_of($package); - next unless grep { $meta->isa($_) } $self->applies_to_metaclass; + my $meta = Class::MOP::class_of($package) + or next; + + grep { $meta->isa($_) } $self->applies_to_metaclass + or next; push @violations, $self->violates_metaclass($meta, $doc); } @@ -46,6 +49,7 @@ sub compile_document { my $doc = $self->document; eval "$doc"; + die "Unable to execute " . $doc->file . ": $@"; } sub find_packages {