2009/10/20 Yuri Shtil <yu...@juniper.net>:
> The problem is that it still has all properties and methods and can be
> operated upon.
> What would be a quick way to disable (most) of its attribute and methods?
>
> For example I would like to leave the name attribute alone, but have all
> other attributes/methods throw an exception or set an error when invoked.
Separate those attributes into a separate role or base class, and then
create a class:
package Disabled;
use Moose;
use Carp;
use namespace::clean;
extend "Base::Class";
sub AUTOLOAD { croak "This object is no longer active" }
to disable an object, rebless to that class:
sub remove { bless $_[0], "Disabled" }