Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'm neither a Moose nor a Ruby expert, but I think with this Ruby code one can instantiate multiple objects each with individual states.
But since Moose roles operate on classes you'll be restricted on a singleton class, i.e. just one object (resp. all objects with the same state.) But again theoretical thoughts, maybe better if I refrain from this subject. But thanks for bringing it up, I learned a lot.
Cheers Rolf ( addicted to the Perl Programming Language) PS: I just remember that I once had a similar requirement which I solved with a state attribute. So calling $self->{state}{method}() solved it for me and I was able to have multidimensional states per object. Thats very similar to the already proposed proxy-methods. In reply to Re^5: a State machine with Roles - possible? (class or instance)
by LanX
|
|