Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • MooseX::POE's events are eventually named. They become first class methods in the class as well as events in the ObjectState Session that MooseX::POE creates for the instance. For example the following will "just work" (and print out a warning about POE::Kernel not being run).

    package Foo;
    use 5.10.0;
    use MooseX::POE;
    event bar => sub { say 'BAR!' };

    package main;
    Foo->new->bar(); # prints "BAR!\n"

    Also any tests that you happen to want to push back into MooseX::POE will be *greatly* appreciated. The c

    • Thanks for the clarification. I reckon that going through MX::POE code, I could also probably make my framework even better. Right now each event requires adding a line in order for the framework to track it. If I could get a list of the events, I could put in the added line myself perhaps.

      I'm also checking into Sub::Caller or stack modules to try and remove the need for parameters to the added line.

      Once I decide how to name my framework, I'll put it on Github and CPAN and people will (hopefully) be able to

      • The event are stored in the metaclass.

        my @events = $self->meta->get_events;

        I've been going through the code myself recent, cleaning up an edge case bug that someone discovered, and modernizing the codebase a bit (the next version will depend on Moose 0.90+ but drops the MooseX::AttributeHelpers dependency).

        • That's awesome!

          Do you know if there's any way to get the arguments a method you've hooking to is getting? For example:

          package A;
          use Moose;
          sub hello {
              my ( $self, $msg ) = @_;
              say $msg;

          package B;
          use Moose;
          extends 'A';
          before 'hello' => sub {
              # i want to get the $msg parameter hello() got

          • Is this what you are asking for?

            #!/usr/bin/env perl
            use strict;
            use Test::More tests => 6;


                package Base;
                use MooseX::POE;

                sub START {
                    ::pass('Base Start');

                event hello => sub {

                package Extended;
                use MooseX::POE;

                extends 'Base';


            • Actually it is!

              This would really help me with the framework. I could automatically hook up to all events. Putting it in will make my code able to work automatically by adding only a single line of "with".


              • Sorry, I wasn't clear. That code works *now*. It should work in the CPAN version. Go forth and test away!