wiki:XasLibPoeSession

Version 5 (modified by kevin, 2 years ago) (diff)

--

NAME

XAS::Lib::POE::Session - The base class for all POE Sessions.

SYNOPSIS

 my $session = XAS::Lib::POE::Session->new(
     -alias => 'name',
 );

DESCRIPTION

This module provides an object based POE session. This object will perform the necessary actions for the lifetime of the session. This includes signal handling. Due to the nature of POE events, they can not be inherited from, but the event handlers can call methods which can. To effectively inherit from this class, you need to walk the SUPER chain to process overridden methods.

METHODS

new

This method initializes the modules. It inherits from [wiki:XasBase XAS::Base] and takes these parameters:

-alias

The name of the POE session, defaults to 'session'.

session_initialize

This method is called after session startup and is used for initialization. This initialization may include defining additonal event. By default it sets up signal handling for these signals:

    HUP
    INT
    TERM
    QUIT

session_startup

This method is where actual processing starts to happen.

session_shutdown

This method is called when your session is shutting down.

session_reload

This method should perform reload actions for the session. By default it calls POE's sig_handled() method which terminates further handling of the HUP signal.

session_interrupt($signal)

This is called when the process receives a signal. By default, when a HUP signal is received it will call session_reload() otherwise it calls session_shutdown().

$signal

The signal that was trapped.

session_exception($ex)

This is called when a exception or "die" happens. By default, this just prints out the messages and continues on. This provides a default exception handler for a session.

$ex

The exception hash that is generated by POE. The field 'error_str' is used to print out the exception message.

session_stop

This method is called when POE starts doing "_stop" activities.

run

A short cut to POE's run() method.

SEE ALSO

XAS

AUTHOR

Kevin L. Esteb, <kevin@…>

COPYRIGHT AND LICENSE

Copyright (C) 2014 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0. =cut