);
sub applies_to { 'PPI::Document' }
-sub applies_to_metaclass { 'Class::MOP::Class' }
+sub applies_to_metaclass { 'Class::MOP::Class', inner() }
around violation => sub {
my $orig = shift;
Readonly::Scalar my $EXPL => q{Prefix builder method names with an underscore};
+augment applies_to_metaclass => sub { 'Moose::Meta::Role' };
+
sub violates_metaclass {
my $self = shift;
my $meta = shift;
my $attributes = $meta->get_attribute_map;
for my $name (keys %$attributes) {
my $attribute = $attributes->{$name};
+ my $builder;
- next if !$attribute->has_builder;
-
- my $builder = $attribute->builder;
+ if (blessed($attribute)) {
+ next if !$attribute->has_builder;
+ $builder = $attribute->builder;
+ }
+ else {
+ # Roles suck :(
+ next if !defined($attribute->{builder});
+ $builder = $attribute->{builder};
+ }
if ($builder !~ /^_/) {
my $desc = "Builder method '$builder' of attribute '$attribute' of class '$classname' is public";