From: Peter Rabbitson Date: Sun, 28 Oct 2012 11:15:39 +0000 (+0100) Subject: Generalize warning of undesirable accessor names X-Git-Tag: v0.10007~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=33fe229924ce0cfe5f74252774ff923910a70fbb;p=p5sagit%2FClass-Accessor-Grouped.git Generalize warning of undesirable accessor names --- diff --git a/lib/Class/Accessor/Grouped.pm b/lib/Class/Accessor/Grouped.pm index c568f6b..24b6971 100644 --- a/lib/Class/Accessor/Grouped.pm +++ b/lib/Class/Accessor/Grouped.pm @@ -73,12 +73,14 @@ sub _mk_group_accessors { $maker = $self->can($maker) unless ref $maker; for (@fields) { - if( $_ eq 'DESTROY' ) { - Carp::carp("Having a data accessor named DESTROY in '$class' is unwise."); - } my ($name, $field) = (ref $_) ? (@$_) : ($_, $_); + for (qw/DESTROY AUTOLOAD CLONE/) { + Carp::carp("Having a data accessor named '$name' in '$class' is unwise.") + if $name eq $_; + } + my $alias = "_${name}_accessor"; for my $meth ($name, $alias) {