1MooseX::POE(3)        User Contributed Perl Documentation       MooseX::POE(3)
2
3
4

NAME

6       MooseX::POE - The Illicit Love Child of Moose and POE
7

VERSION

9       This document describes MooseX::POE version 0.205
10

SYNOPSIS

12           package Counter;
13           use MooseX::POE;
14
15           has count => (
16               isa     => 'Int',
17               is      => 'rw',
18               lazy    => 1,
19               default => sub { 0 },
20           );
21
22           sub START {
23               my ($self) = @_;
24               $self->yield('increment');
25           }
26
27           event increment => sub {
28               my ($self) = @_;
29               print "Count is now " . $self->count . "\n";
30               $self->count( $self->count + 1 );
31               $self->yield('increment') unless $self->count > 3;
32           };
33
34           no MooseX::POE;
35
36           Counter->new();
37           POE::Kernel->run();
38
39       or with MooseX::Declare:
40
41           class Counter {
42               use MooseX::POE::SweetArgs qw(event);
43
44               has count => (
45                   isa     => 'Int',
46                   is      => 'rw',
47                   lazy    => 1,
48                   default => sub { 0 },
49               );
50
51               sub START {
52                   my ($self) = @_;
53                   $self->yield('increment')
54               }
55
56               event increment => sub {
57                   my ($self) = @_;
58                   print "Count is now " . $self->count . "\n";
59                   $self->count( $self->count + 1 );
60                   $self->yield('increment') unless $self->count > 3;
61               }
62           }
63

DESCRIPTION

65       MooseX::POE is a Moose wrapper around a POE::Session.
66

KEYWORDS

68       event $name $subref
69           Create an event handler named $name.
70

METHODS

72       Default POE-related methods are provided by
73       MooseX::POE::Meta::Trait::Object which is applied to your base class
74       (which is usually Moose::Object) when you use this module. See that
75       module for the documentation for. Below is a list of methods on that
76       class so you know what to look for:
77
78       get_session_id
79       yield
80       call
81       STARTALL
82       STOPALL
83

NOTES ON USAGE WITH MooseX::Declare

85       MooseX::Declare support is still "experimental". Meaning that I don't
86       use it, I don't have any code that uses it, and thus I can't adequately
87       say that it won't cause monkeys to fly out of any orafices on your body
88       beyond what the tests and the SYNOPSIS cover.
89
90       That said there are a few caveats that have turned up during testing.
91
92       1. The "method" keyword doesn't seem to work as expected. This is an
93       integration issue that is being resolved but I want to wait for
94       MooseX::Declare to gain some more polish on their slurpy arguments.
95
96       2. MooseX::POE attempts to re-export Moose, which MooseX::Declare has
97       already exported in a custom fashion.  This means that you'll get a
98       keyword clash between the features that MooseX::Declare handles for you
99       and the features that Moose handles. To work around this you'll need to
100       write:
101
102           use MooseX::POE qw(event);
103           # or
104           use MooseX::POE::SweetArgs qw(event);
105           # or
106           use MooseX::POE::Role qw(event);
107
108       to keep MooseX::POE from exporting the sugar that MooseX::Declare
109       doesn't like. This is fixed in the Git version of MooseX::Declare but
110       that version (as of this writing) is not on the CPAN.
111

DEPENDENCIES

113       Moose
114
115       POE
116

AUTHOR

118       Chris Prather  "<chris@prather.org>"
119
120       Ash Berlin "<ash@cpan.org>"
121
122       Chris Williams "<chris@bingosnet.co.uk">
123
124       Yuval (nothingmuch) Kogman
125
127       Copyright (c) 2007-2009, Chris Prather "<chris@prather.org>", Ash
128       Berlin "<ash@cpan.org>", Chris Williams "<chris@bingosnet.co.uk">,
129       Yuval (nothingmuch) Kogman. Some rights reserved.
130
131       This module is free software; you can redistribute it and/or modify it
132       under the same terms as Perl itself. See perlartistic.
133

DISCLAIMER OF WARRANTY

135       BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
136       FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
137       WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
138       PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
139       EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
140       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
141       ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
142       YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
143       NECESSARY SERVICING, REPAIR, OR CORRECTION.
144
145       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
146       WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
147       REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
148       TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
149       CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
150       SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
151       RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
152       FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
153       SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
154       DAMAGES.
155
156
157
158perl v5.12.0                      2009-06-26                    MooseX::POE(3)
Impressum