1MooseX::POE::Meta::TraiUts:e:rObCjoencttr(i3b)uted PerlMDooocsuemXe:n:tPaOtEi:o:nMeta::Trait::Object(3)
2
3
4
6 MooseX::POE::Meta::Trait::Object - The base class role for MooseX::Poe
7
9 package Counter;
10 use MooseX::Poe;
11
12 has name => (
13 isa => 'Str',
14 is => 'rw',
15 default => sub { 'Foo ' },
16 );
17
18 has count => (
19 isa => 'Int',
20 is => 'rw',
21 lazy => 1,
22 default => sub { 0 },
23 );
24
25 sub START {
26 my ($self) = @_;
27 $self->yield('increment');
28 }
29
30 sub increment {
31 my ($self) = @_;
32 $self->count( $self->count + 1 );
33 $self->yield('increment') unless $self->count > 3;
34 }
35
36 no MooseX::Poe;
37
39 MooseX::POE::Meta::TraitObject is a role that is applied to the object
40 base classe (usually Moose::Object) that implements a POE::Session.
41
43 get_session_id
44 Get the internal POE Session ID, this is useful to hand to other
45 POE aware functions.
46
47 yield
48 A cheap alias for POE::Kernel->yield() which will gurantee posting
49 to the object's session.
50
51 STARTALL
52 Along similar lines to Moose's "BUILDALL" method which calls all
53 the "BUILD" methods, this function will call all the "START"
54 methods in your inheritance hierarchy automatically when POE first
55 runs your session. (This corresponds to the "_start" event from
56 POE.)
57
58 STOPALL
59 Along similar lines to "STARTALL", but for "STOP" instead.
60
62 START
63 STOP
64 DEFAULT
65 CHILD
66 PARENT
67
69 Chris Prather "<perigrin@cpan.org>"
70
71 Ash Berlin "<ash@cpan.org>"
72
74 Copyright (c) 2007-2009, Chris Prather "<perigrin@cpan.org>", Ash
75 Berlin "<ash@cpan.org>". All rights reserved.
76
77 This module is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself. See perlartistic.
79
81 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
82 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
83 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
84 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
85 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
86 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
87 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
88 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
89 NECESSARY SERVICING, REPAIR, OR CORRECTION.
90
91 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
92 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
93 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
94 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
95 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
96 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
97 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
98 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
99 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
100 DAMAGES.
101
102
103
104perl v5.12.0 2009-06-22MooseX::POE::Meta::Trait::Object(3)