Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^7: Why does changing a Moose attributes' properties remove the around modifier

by mcrose (Beadle)
on Jul 20, 2011 at 14:18 UTC ( [id://915663]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Why does changing a Moose attributes' properties remove the around modifier
in thread Why does changing a Moose attributes' properties remove the around modifier

Yeah, that's a much better way of behaving. I'd missed the documentation that mentioned 'init_arg'. I do need to read through the Class::MOP stuff some time to make sure I'm not missing out on things like this. Thanks for the pointer.

  • Comment on Re^7: Why does changing a Moose attributes' properties remove the around modifier

Replies are listed 'Best First'.
Re^8: Why does changing a Moose attributes' properties remove the around modifier
by ikegami (Patriarch) on Jul 20, 2011 at 18:46 UTC

    It's possible to do without init_arg (which I didn't know about for the longest time either), but it's less clear.

    for my $field (qw( server peer monitor netlog )) { my $object = "${field}_object"; has $field => ( reader => $object, isa => 'NetAddr::IP', coerce => 1, required => 1, handles => { $field => sub { $_[0]->$object->addr }, }, ); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-16 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found