On Mon, Apr 29, 2013 at 2:07 PM, Brian ROONEY < brian.xb.roo...@stericsson.com> wrote:
> Anyone know a bit of meta or other way to delete a MM or disable a MM from > firing? > > package Stuff; > > with 'OtherStuff'; # run() > > after 'run' => sub { @_[0]->check }; > > sub check { # yadda... } > > __PACKAGE__->meta->make_immutable;no Moose;1; > > > my $p = Stuff->new; > # delete or disable MM so I can test check() autonomously > $p->run; > > $p->check; > > If this is just for testing you can add a flag to the class package Stuff; use Moose; with 'OtherStuff'; if (!$ENV{TESTING}) { after 'run' => sub { $_[0]->check }; } .... then when you want to disable those methods for testing just set $ENV{TEST} = 1 -Chris