1MooseX::POE::SweetArgs(U3s)er Contributed Perl DocumentatMiooonseX::POE::SweetArgs(3)
2
3
4
6 MooseX::POE::SweetArgs - sugar around MooseX::POE event arguments
7
9 package Thing;
10 use MooseX::POE::SweetArgs;
11
12 # declare events like usual
13 event on_success => sub {
14 # unpack args like a Perl sub, not a POE event
15 my ($self, $foo, $bar) = @_;
16 ...
17 POE::Kernel->yield('foo');
18 ...
19 };
20
22 Normally, when using MooseX::POE, subs declared as events need to use
23 POE macros for unpacking @_, e.g.:
24
25 my ($self, $foo, $bar) = @_[OBJECT, ARG0..$#_];
26
27 Using MooseX::POE::SweetArgs as a metaclass lets you avoid this, and
28 just use @_ as normal:
29
30 my ($self, $foo, $bar) = @_;
31
32 Since the POE kernel is a singleton, you can access it using class
33 methods, as shown in the synopsis.
34
35 In all other respects, this behaves exactly like MooseX::POE
36
38 MooseX::POE
39
41 Chris Prather "<perigrin@cpan.org>"
42
43 Ash Berlin "<ash@cpan.org>"
44
45 Hans Dieter Pearcey
46
48 Copyright (c) 2007-2009, Chris Prather "<perigrin@cpan.org>", Ash
49 Berlin "<ash@cpan.org>". All rights reserved.
50
51 This module is free software; you can redistribute it and/or modify it
52 under the same terms as Perl itself. See perlartistic.
53
54
55
56perl v5.12.0 2009-04-05 MooseX::POE::SweetArgs(3)