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

Re: How do you create attribute handlers for methods of an object (via Moose) ?

by ikegami (Pope)
on Sep 26, 2011 at 19:17 UTC ( #927928=note: print w/ replies, xml ) Need Help??


in reply to How do you create attribute handlers for methods of an object (via Moose) ?

This question was also posed on StackOverflow, where I answered the following.


Are you simply overcomplicating things, or am I missing something?

package Bucket; has '_linkedlist' => ( is => 'rw', isa => 'LinkedList', handles => { _add_link => 'append', _insert_link => 'insert', _count_links => 'size', _del_link => 'remove', _split_at_link => 'split', _has_sublinks => 'has_children', }, );

Hashes don't have methods, which is why a trait is involves. The trait adds the methods. Your LinkedList class has methods, so no need to write a trait to provide the methods.


Comment on Re: How do you create attribute handlers for methods of an object (via Moose) ?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2014-10-24 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls