* Use Perl 5.10's new recursive regex features, if possible, for the type
constraint parser (doy, nothingmuch).
+ [ENHANCEMENTS]
+
+ * Attributes now warn if their accessors overwrite a locally defined function
+ (not just method) (doy).
+
[OTHER]
* Bump our required perl version to 5.8.3, since earlier versions fail tests
. "an accessor"
);
}
+ if (!$self->associated_class->has_method($accessor)
+ && $self->associated_class->has_package_symbol('&' . $accessor)) {
+ Carp::cluck(
+ "You are overwriting a locally defined function ($accessor) with "
+ . "an accessor"
+ );
+ }
$self->SUPER::_process_accessors(@_);
}
stderr_like(sub { $foo_meta->add_attribute(e => (is => 'rw')) },
qr/^You are overwriting a locally defined method \(e\) with an accessor/, 'accessor overriding gives proper warning');
+stderr_like(sub { $foo_meta->add_attribute(has => (is => 'rw')) },
+ qr/^You are overwriting a locally defined function \(has\) with an accessor/, 'function overriding gives proper warning');
+
done_testing;