Try this:
before 'custom_field' => sub { my $self = shift; if (scalar @_ == 1) { my $key = shift; confess "The field $key does not exist" unless $self->has_custom_field( $key ); } };
In reply to Re: Setting a custom hash accessor handle in Moose attribute
by stvn
in thread Setting a custom hash accessor handle in Moose attribute
by daverave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |