- COPYRIGHT AND LICENSE
Reflexive::Role::Collective - Provides a composable behavior for containers watching contained events
Reflexive::Role::Collective provides are more comprehensive and extensible way to define collections that act upon events emitted from contained objects.
While Reflex::Collection merely watches for the 'stopped' event and removes it from the collection, a more sophisticated Collection can be built using this role that will do much more such as proper socket management, re-emit events, etc.
store contains the name of the attribute that holds the actual collection of objects.
method_add_object is the name of the method that adds an object to the collection.
method_del_object is the name of the method that deletes objects from the collection.
method_count_objects is the name of the method that returns the current count of objects within the collection.
method_clear_objects is the name of the method that clears the collection of any objects.
method_remember is the name of the method that stores the collectible and sets up watching the events that collectible emits.
method_forget is the name of the method that removes the collectible and ignores any events that the collectible emits.
stored_constraint stores a Moose::Meta::TypeConstaint object to be used to constraint collectibles before they are stored into the collection.
watched_events contains an arrayref of tuples that indicate the event to watch and the callback method name to call when that event occurs. If the callback method name is also a tuple, a method will be setup with the name of the first element of the tuple and it will emit the event in the second element
# example [ some_event => [ 'some_method_that_emits' => 'this_event' ] ]
Internally, the embedded tuple is passed unmodified to "method_emit" in Reflex::Role. This allows for easy setup of watched events that merely re-emit.
This role requires the method ignore from Reflex::Base
This role requires the method watch from Reflex::Base
This role requires the method named in method_clear_objects
This role requires the method named in method_count_objects
This role requires the method named in method_add_object
This role requires the method named in method_del_object
forget takes an object constrained by "store_constraint". It will then ignore all of the events the collection was watching and the object will be removed from the collection.
Nicholas R. Perez <firstname.lastname@example.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Nicholas R. Perez <email@example.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.