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 version 0.215
10
12 package Thing;
13 use MooseX::POE::SweetArgs;
14
15 # declare events like usual
16 event on_success => sub {
17 # unpack args like a Perl sub, not a POE event
18 my ($self, $foo, $bar) = @_;
19 ...
20 POE::Kernel->yield('foo');
21 ...
22 };
23
25 Normally, when using MooseX::POE, subs declared as events need to use
26 POE macros for unpacking @_, e.g.:
27
28 my ($self, $foo, $bar) = @_[OBJECT, ARG0..$#_];
29
30 Using MooseX::POE::SweetArgs as a metaclass lets you avoid this, and
31 just use @_ as normal:
32
33 my ($self, $foo, $bar) = @_;
34
35 Since the POE kernel is a singleton, you can access it using class
36 methods, as shown in the synopsis.
37
38 In all other respects, this behaves exactly like MooseX::POE
39
41 · Chris Prather <chris@prather.org>
42
43 · Ash Berlin <ash@cpan.org>
44
45 · Chris Williams <chris@bingosnet.co.uk>
46
47 · Yuval (nothingmuch) Kogman
48
49 · Torsten Raudssus <torsten@raudssus.de> <http://www.raudssus.de/>
50
52 This software is copyright (c) 2010 by Chris Prather, Ash Berlin, Chris
53 Williams, Yuval Kogman, Torsten Raudssus.
54
55 This is free software; you can redistribute it and/or modify it under
56 the same terms as the Perl 5 programming language system itself.
57
58
59
60perl v5.32.0 2020-07-28 MooseX::POE::SweetArgs(3)