MooseX...Object(3pm)

πŸ“¦
version 0.215 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– MooseX::POE::Meta::Trait::Object πŸ’–

okay bestie, so this is the MooseX...Object(3pm) page β€” the manual for MooseX::POE::Meta::Trait::Object, the base class role for MooseX::POE. it's giving glue-code-that-holds-your-whole-session-together, and honestly? iconic.


✨ VERSION ✨

version 0.215 πŸŽ€


🌸 SYNOPSIS 🌸

package Counter;
use MooseX::Poe;

has name => (
    isa     => 'Str',
    is      => 'rw',
    default => sub { 'Foo ' },
);

has count => (
    isa     => 'Int',
    is      => 'rw',
    lazy    => 1,
    default => sub { 0 },
);

sub START {
    my ($self) = @_;
    $self->yield('increment');
}

sub increment {
    my ($self) = @_;
    $self->count( $self->count + 1 );
    $self->yield('increment') unless $self->count > 3;
}

no MooseX::Poe;

like. look at it. it's a whole little counter and it just works. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so MooseX::POE::Meta::TraitObject is a role β€” and the way that works is it gets applied to the object base classe (usually Moose::Object) that implements a POE::Session. that's the whole vibe. it's the little trait that makes your Moose object actually be a POE session. no cap. 🫢


πŸ’œ METHODS πŸ’œ

get_session_id

gets you the internal POE Session ID. this is highkey useful to hand off to other POE aware functions. like here, take my ID, go be a session about it. 😭

yield / call / delay / alarm / alarm_add / delay_add / alarm_set / alarm_adjust / alarm_remove / alarm_remove_all / delay_set / delay_adjust

a cheap alias for the same POE::Kernel function β€” except this one will gurantee posting to the object's session. (yes, that's the original spelling, we keep it exactly, we do not fix, we do not touch, it's part of the lore now 🌈)

so basically: same function name you already know from POE::Kernel, but it's guaranteed to land in your object's session. obsessed.

STARTALL

along similar lines to Moose's BUILDALL method β€” which calls all the BUILD methods β€” this function will call all the START methods in your inheritance hierarchy automatically when POE first runs your session. ✨

(this corresponds to the _start event from POE.)

so you don't gotta manually go find every START up the chain, it just does the whole ancestry for you. main character energy fr fr.

STOPALL

along similar lines to STARTALL, but for STOP instead. πŸ’€

START

STOP

DEFAULT

CHILD

PARENT


🌈 DEFAULT METHODS 🌈

(no extra deets in the original β€” this is just the section header, so it stays a header, bestie. we don't invent facts in this house πŸ’–)


⭐ PREDEFINED EVENTS ⭐

(also just a header in the original. nothing more. periodt.)


πŸ‘‘ 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/>

the whole friend group showed up to write this and we love that for them πŸ₯ΉπŸ’–


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. slay. legal AND free. πŸ’…


lowkey reminder bestie: MooseX::POE::Meta::Trait::Object is the role, MooseX::POE is the thing you use, and no MooseX::Poe; cleans up after you. don't forget the cleanup, it's the skincare routine of Perl 🧚

okay that's the whole page!! πŸ’œ this was documented by the perl crew, perl v5.26.1, dated 2018-03-30 β€” and that's the footer, so like, that's a wrap. bye bestie, go build a session πŸ¦‹βœ¨

πŸ“¦ where this page comes from