use Class::MOP ();
use Scalar::Util ();
-our $VERSION = '0.00600';
+our $VERSION = '0.00700';
=head1 NAME
sub mk_accessors{
my $self = shift;
my $meta = $locate_metaclass->($self);
+ my $class = $meta->name;
+ confess("You are trying to modify ${class}, which has been made immutable, this is ".
+ "not supported. Try subclassing ${class}, rather than monkeypatching it")
+ if $meta->is_immutable;
+
for my $attr_name (@_){
+ $meta->remove_attribute($attr_name)
+ if $meta->find_attribute_by_name($attr_name);
my $reader = $self->accessor_name_for($attr_name);
my $writer = $self->mutator_name_for( $attr_name);
sub mk_ro_accessors{
my $self = shift;
my $meta = $locate_metaclass->($self);
+ my $class = $meta->name;
+ confess("You are trying to modify ${class}, which has been made immutable, this is ".
+ "not supported. Try subclassing ${class}, rather than monkeypatching it")
+ if $meta->is_immutable;
for my $attr_name (@_){
+ $meta->remove_attribute($attr_name)
+ if $meta->find_attribute_by_name($attr_name);
my $reader = $self->accessor_name_for($attr_name);
my @opts = ($meta->has_method($reader) ? () : (reader => $reader) );
my $attr = $meta->add_attribute($attr_name, @opts);
sub mk_wo_accessors{
my $self = shift;
my $meta = $locate_metaclass->($self);
+ my $class = $meta->name;
+ confess("You are trying to modify ${class}, which has been made immutable, this is ".
+ "not supported. Try subclassing ${class}, rather than monkeypatching it")
+ if $meta->is_immutable;
for my $attr_name (@_){
+ $meta->remove_attribute($attr_name)
+ if $meta->find_attribute_by_name($attr_name);
my $writer = $self->mutator_name_for($attr_name);
my @opts = ($meta->has_method($writer) ? () : (writer => $writer) );
my $attr = $meta->add_attribute($attr_name, @opts);