NAME

POEx::Role::SessionInstantiation::Meta::Session::Implementation - Provides actual POE::Session implementation

VERSION

version 1.100912

PUBLIC_ATTRIBUTES

options

is: rw, isa: HashRef, default: {}, lazy: yes

In following the POE::Session API, sessions can take options that do various things related to tracing and debugging. By default, tracing => 1, will turn on tracing of POE event firing to your object. debug => 1, currently does nothing but more object level tracing maybe enabled in future versions.

args

is: rw, isa: ArrayRef, default: [], lazy: yes

POE::Session's constructor provides a mechanism for passing arguments that will end up as arguments to the _start event handler. This is the exact same thing.

alias

is: rw, isa: Str, clearer: clear_alias, trigger: registers alias

This attribute controls your object's alias to POE. POE allows for more than one alias to be assigned to any given session, but this attribute only assumes a single alias and will not attempt to keep track of all the aliases. Last alias set will be what is returned. Calling the clearer will remove the last alias set from POE and unset it. You must be inside a valid POE context for the trigger to actually fire (ie, inside a event handler that has been invoked from POE). While this can be set at construction time, it won't be until _start that it will actually register with POE. If you override _start, don't forget to set this attribute again ( $self->alias($self->alias); ) or else your alias will never get registered with POE.

ID

is: ro, isa: Int

This attribute will return what your POE assigned Session ID is. Must only be accessed after your object has been fully built (ie. after any BUILD methods). This ID can be used, in addition to a reference to yourself, and your defined alias, by other Sessions for addressing events sent through POE to your object.

PROTECTED_ATTRIBUTES

heap

is: rw, isa: Any, default: {}, lazy: yes  

A traditional POE::Session provides a set aside storage space for the session context and that space is provided via argument to event handlers. With this Role, your object gains its own heap storage via this attribute.

poe

is: ro, isa: POEx::Role::SessionInstantiation::Meta::POEState

The poe attribute provides runtime context for your object methods. It contains an POEState object with it's own attributes and methods. Runtime context is built for each individual event handler invocation and then torn down to avoid context crosstalk. It is important to only access this attribute from within a POE invoked event handler. Please see POEx::Role::SessionInstantiation::Meta::POEState for information regarding its methods and attributes.

PRIVATE_METHODS

_invoke_state

(Kernel|Session|DoesSessionInstantiation $sender, Str $state, ArrayRef $etc, Maybe[Str] $file, Maybe[Int] $line, Maybe[Str] $from)

_invoke_state is the dispatch method called by POE::Kernel to deliver events. It will introspect via meta to find the $state given by the Kernel. If the method exists, but doesn't compose the POEx::Role::Event role, a warning will be issued, and the method /not/ executed. If the method doesn't exist, it will search for a method call '_default' (which also must be marked as an event). If it can't find that, it gives up with a warning.

Otherwise, it will build a POEState object, and then execute the method passing @$etc as arguments. In the case of '_default', $etc will be passed as is.

_register_state

(Str $method_name, Maybe[CodeRef|MooseX::Method::Signatures::Meta::Method] $coderef, Maybe[Str] $ignore)

_register_state is called by the Kernel anytime an event is added to a session via POE::Kernel's state() method. This can happen from an arbitrary source or from within the session itself via POE::Wheel instances.

POE::Wheels register plain old code refs that must be wrapped appropriately. Otherwise it expects fullblown methods that compose POEx::Role::Event.

_wheel_wrap_method

(CodeRef|MooseX::Method::Signatures::Meta::Method $ref)

_wheel_wrap_method is a private method that makes sure wheel states are called how they think they should be called. This allows proper interaction with the default POE Wheel implementations.

AUTHOR

Nicholas Perez <nperez@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Nicholas Perez.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.