POE::Sugar::Args - Get "pretty", OO representation of args.
use POE::Sugar::Args; sub _start { my $poe = sweet_args; $poe->kernel->yield( '_stop' ); } # or, the long, boring way sub _stop { my $poe = POE::Sugar::Args->new( @_ ); delete $poe->heap->{client}; }
This module give an OO representation to arguments POE passes to event states. I will not lie to you. This adds heavy, bulky code underneath. On the other hand, it makes arguments for POE events much more palatable. Of course, this is a Sugar module, meaning, it will rot your program in odd (you'll be hooked) and unexpected ways (performace), but you took the candy so you can suffer the consequences. Good luck.
This function will get @_ from the calling state by doing deep, dark voodoo. It will construct the POE::Sugar::Args object for you. Very handy.
@_
POE::Sugar::Args
Constructs an object. Expects all of @_ that's passed to an event state.
If this state was initialized as an object_state in the session, the object will be here.
object_state
POE::Session object.
POE::Kernel object.
Your heap.
Event name that invoked the state.
Reference to the session that send the event.
The calling file.
The calling line.
All arguments this event was called with.
Casey West <casey@geeknest.com>
Rocco Caputo -- Much help with code and overall inspiration.
Copyright (c) 2003 Casey West. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl, Devel::Caller, DB, perldebguts.
To install POE::Sugar::Args, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Sugar::Args
CPAN shell
perl -MCPAN -e shell install POE::Sugar::Args
For more information on module installation, please visit the detailed CPAN module installation guide.