POE/SweetArgs.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 95.2% 20 / 21 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« POE/Meta/Trait/Object.pm ↑ Summary POE.pm »
1 package MooseX::POE::SweetArgs;
2 {
3 1 $MooseX::POE::SweetArgs::VERSION = '0.215';
4 }
5 # ABSTRACT: sugar around MooseX::POE event arguments
6  
7 1 ▶use Moose ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooseX::POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Moose::Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 1 Moose::Exporter->setup_import_methods(
13 also => 'MooseX::POE',
14 );
15  
16 1 ▶sub init_meta {
Subroutine init_meta: called CC=1 SCAR=0.0
Pod undocumented
17 1 my ($class, %args) = @_;
18 1 MooseX::POE->import({ into => $args{for_class} });
19  
20 Moose::Util::MetaRole::apply_metaroles(
21 for => $args{for_class},
22 1 class_metaroles => {
23 class => ['MooseX::POE::Meta::Trait::SweetArgs'],
24 },
25 );
26 }
27  
28  
29 1 1;
30  
31  
32 =pod
33  
34 =head1 NAME
35  
36 MooseX::POE::SweetArgs - sugar around MooseX::POE event arguments
37  
38 =head1 VERSION
39  
40 version 0.215
41  
42 =head1 SYNOPSIS
43  
44 package Thing;
45 use MooseX::POE::SweetArgs;
46  
47 # declare events like usual
48 event on_success => sub {
49 # unpack args like a Perl sub, not a POE event
50 my ($self, $foo, $bar) = @_;
51 ...
52 POE::Kernel->yield('foo');
53 ...
54 };
55  
56 =head1 DESCRIPTION
57  
58 Normally, when using MooseX::POE, subs declared as events need to use POE
59 macros for unpacking C<@_>, e.g.:
60  
61 my ($self, $foo, $bar) = @_[OBJECT, ARG0..$#_];
62  
63 Using MooseX::POE::SweetArgs as a metaclass lets you avoid this, and just use
64 C<@_> as normal:
65  
66 my ($self, $foo, $bar) = @_;
67  
68 Since the POE kernel is a singleton, you can access it using class methods, as
69 shown in the synopsis.
70  
71 In all other respects, this behaves exactly like MooseX::POE
72  
73 =for :list * L<MooseX::POE|MooseX::POE>
74  
75 =head1 AUTHORS
76  
77 =over 4
78  
79 =item *
80  
81 Chris Prather <chris@prather.org>
82  
83 =item *
84  
85 Ash Berlin <ash@cpan.org>
86  
87 =item *
88  
89 Chris Williams <chris@bingosnet.co.uk>
90  
91 =item *
92  
93 Yuval (nothingmuch) Kogman
94  
95 =item *
96  
97 Torsten Raudssus <torsten@raudssus.de> L<http://www.raudssus.de/>
98  
99 =back
100  
101 =head1 COPYRIGHT AND LICENSE
102  
103 This software is copyright (c) 2010 by Chris Prather, Ash Berlin, Chris Williams, Yuval Kogman, Torsten Raudssus.
104  
105 This is free software; you can redistribute it and/or modify it under
106 the same terms as the Perl 5 programming language system itself.
107  
108 =cut
109  
110  
111 __END__
« POE/Meta/Trait/Object.pm ↑ Summary POE.pm »