MooseX::POE(3pm)
π MooseX::POE π
okay so welcome to the MooseX::POE(3pm) page, bestie β yeah it's User Contributed Perl Documentation, we stan a community-produced icon. the manual name is literally right up there in the title, so let's go π«Ά
β¨ NAME β¨
MooseX::POE β The Illicit Love Child of Moose and POE π
like. that's the actual tagline. the drama of it all.
π VERSION π
version 0.215 β¨
πΈ SYNOPSIS πΈ
okay here's the whole vibe in code form, no notes:
package Counter;
use MooseX::POE;
has count => (
isa => 'Int',
is => 'rw',
lazy => 1,
default => sub { 0 },
);
sub START {
my ($self) = @_;
$self->yield('increment');
}
event increment => sub {
my ($self) = @_;
print "Count is now " . $self->count . "\n";
$self->count( $self->count + 1 );
$self->yield('increment') unless $self->count > 3;
};
no MooseX::POE;
Counter->new();
POE::Kernel->run();
or, if you're feeling extra, with MooseX::Declare:
class Counter {
use MooseX::POE::SweetArgs qw(event);
has count => (
isa => 'Int',
is => 'rw',
lazy => 1,
default => sub { 0 },
);
sub START {
my ($self) = @_;
$self->yield('increment')
}
event increment => sub {
my ($self) = @_;
print "Count is now " . $self->count . "\n";
$self->count( $self->count + 1 );
$self->yield('increment') unless $self->count > 3;
}
}
Counter->new();
POE::Kernel->run();
(and yes, that missing semicolon in the second one is exactly how it's written here, i am simply the messenger π )
π DESCRIPTION π
MooseX::POE is a Moose wrapper around a POE::Session. that's it. that's the whole thing. Moose on the outside, POE on the inside, iconic behavior fr fr.
π₯ METHODS π₯
event $name $subref
creates an event handler and names it $name. cute, simple, slay.
get_session_id
gives you back the internal POE Session ID. super handy when you need to hand it off to other POE-aware functions that are like "where's your session id bestie" π¦
yield
call
delay
alarm
alarm_add
delay_add
alarm_set
alarm_adjust
alarm_remove
alarm_remove_all
delay_set
delay_adjust
all of these are cheap aliases for the exact same POE::Kernel function of the same name, except they guarantee that posting happens to the object's own session. same energy, zero ambiguity π
STARTALL
STOPALL
π KEYWORDS π
METHODS
the default POE-related methods come from MooseX::POE::Meta::Trait::Object, which gets applied to your base class (and that base class is usually Moose::Object) the moment you use this module. go read that module for the docs, okay? the list of methods on that class is down below so you know exactly what to go looking for π
π§ NOTES ON USAGE WITH MooseX::Declare π§
MooseX::Declare support is still "experimental". and when i say experimental i mean: the author doesn't use it, doesn't have any code that uses it, and therefore genuinely cannot promise it won't cause monkeys to fly out of any orifices on your body beyond what the tests and the SYNOPSIS cover. so. there's that π
that said, a couple of caveats have turned up during testing:
- the
"method"keyword doesn't seem to work as expected. it's an integration issue that's being resolved, but the author wants to wait forMooseX::Declareto gain some more polish on their slurpy arguments first. MooseX::POEattempts to re-export Moose, andMooseX::Declarehas already exported Moose in its own custom fashion. so you end up with a keyword clash between the featuresMooseX::Declarehandles for you and the features Moose handles. to work around it you'll need to write:
use MooseX::POE qw(event);
# or
use MooseX::POE::SweetArgs qw(event);
# or
use MooseX::POE::Role qw(event);
that keeps MooseX::POE from exporting the sugar that MooseX::Declare doesn't like. this is fixed in the Git version of MooseX::Declare, but that version (as of this writing) is not on the CPAN. π₯²
π SEE ALSO π
...it's empty. nothing here. a blank space, a moment of silence, main character energy with no supporting cast π
π AUTHORS π
- Chris Prather <chris@prather.org>
- Ash Berlin <ash@cpan.org>
- Chris Williams <chris@bingosnet.co.uk>
- Yuval (nothingmuch) Kogman
- Torsten Raudssus <torsten@raudssus.de> <http://www.raudssus.de/>
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2010 by Chris Prather, Ash Berlin, Chris Williams, Yuval Kogman, Torsten Raudssus.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. periodt. π
and that's the whole page bestie!! brought to you byperl v5.26.1, dated2018-03-30, and filed underMooseX::POE(3pm). go write some events, you absolute icon πβ¨π¦
π¦ where this page comes from
- debian bookworm: libmoosex-poe-perl 0.215-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-poe-perl 0.215-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libmoosex-poe-perl 0.215-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-poe-perl 0.215-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms