From: Shawn M Moore Date: Tue, 28 Apr 2009 08:38:57 +0000 (-0400) Subject: Switch to Sub::Exporter, use meta_type in PPB X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7b3c959c8a0ea21030251f148f37910e4cf3d6b0;p=gitmo%2FPerl-Critic-Dynamic-Moose.git Switch to Sub::Exporter, use meta_type in PPB --- diff --git a/lib/Perl/Critic/Policy/DynamicMoose/ProhibitPublicBuilders.pm b/lib/Perl/Critic/Policy/DynamicMoose/ProhibitPublicBuilders.pm index 90155ab..2d93702 100644 --- a/lib/Perl/Critic/Policy/DynamicMoose/ProhibitPublicBuilders.pm +++ b/lib/Perl/Critic/Policy/DynamicMoose/ProhibitPublicBuilders.pm @@ -2,6 +2,8 @@ package Perl::Critic::Policy::DynamicMoose::ProhibitPublicBuilders; use Moose; extends 'Perl::Critic::Policy::DynamicMoose'; +use Perl::Critic::Util::Moose 'meta_type'; + Readonly::Scalar my $EXPL => q{Prefix builder method names with an underscore}; augment applies_to_metaclass => sub { 'Moose::Meta::Role' }; @@ -30,7 +32,8 @@ sub violates_metaclass { } if ($builder !~ /^_/) { - my $desc = "Builder method '$builder' of attribute '$attribute' of class '$classname' is public"; + my $type = meta_type($meta); + my $desc = "Builder method '$builder' of attribute '$attribute' of $type '$classname' is public"; push @violations, $self->violation($desc, $EXPL); } } diff --git a/lib/Perl/Critic/Util/Moose.pm b/lib/Perl/Critic/Util/Moose.pm index f65520b..751d01f 100644 --- a/lib/Perl/Critic/Util/Moose.pm +++ b/lib/Perl/Critic/Util/Moose.pm @@ -1,9 +1,9 @@ package Perl::Critic::Util::Moose; use strict; use warnings; -use base 'Exporter'; - -our @EXPORTS_OK = 'meta_type'; +use Sub::Exporter -setup => { + exports => ['meta_type'], +}; my @types = ( [ 'Moose::Meta::Role' => 'role' ],