Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Setting a custom hash accessor handle in Moose attribute

by stvn (Monsignor)
on Oct 24, 2010 at 23:35 UTC ( #867105=note: print w/ replies, xml ) Need Help??


in reply to Setting a custom hash accessor handle in Moose attribute

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 ); } };

-stvn


Comment on Re: Setting a custom hash accessor handle in Moose attribute
Download Code
Re^2: Setting a custom hash accessor handle in Moose attribute
by daverave (Scribe) on Oct 25, 2010 at 17:27 UTC
    Thank you.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://867105]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2015-07-05 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls