> This might be preferable to my suggestion if your object's methods are being
> called mid-parse, rather than building up a data structure first and setting
> attributes based on it after parsing is done. Even then, I think I'd rather
> have a separate method than modify the accessor.
Yea that was me being a dumb ass.
has 'attribute' => ( isa => 'Str', is => 'rw', predicate => 'has_attribute' );
around 'attribute' => sub {
my ($next, $this, $key) = @_;
if ( $key ) {
$self->has_attribute ? die 'exception' : $this->$next($key);
}
else {
$this->$next
}
};
etc.,
--
Evan Carroll
System Lord of the Internets
http://www.evancarroll.com