NAME
MooseX::POE::SweetArgs - sugar around MooseX::POE event arguments
SYNOPSIS
package Thing;
# must come before MooseX::POE!
use metaclass 'MooseX::POE::SweetArgs';
use MooseX::POE;
# declare events like usual
event on_success => sub {
# unpack args like a Perl sub, not a POE event
my ($self, $foo, $bar) = @_;
...
};
DESCRIPTION
Normally, when using MooseX::POE, subs declared as events need to use POE macros for unpacking @_
, e.g.:
my ($self, $foo, $bar) = @_[OBJECT, ARG0..$#_];
Using MooseX::POE::SweetArgs as a metaclass lets you avoid this, and just use @_
as normal:
my ($self, $foo, $bar) = @_;