Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (33 sloc) 0.608 kB
#!/usr/bin/env perl
use lib qw(../lib);
{
package Echoer;
use Moose;
extends 'Reflex::Base';
sub ping {
my ($self, $args) = @_;
print "Echoer was pinged!\n";
$self->emit( event => "pong" );
}
}
{
package Pinger;
use Moose;
extends 'Reflex::Base';
has echoer => (
is => 'ro',
isa => 'Echoer',
default => sub { Echoer->new() },
traits => ['Reflex::Trait::Observed'],
);
sub BUILD {
my $self = shift;
$self->echoer->ping();
}
sub on_echoer_pong {
my $self = shift;
print "Pinger got echoer's pong!\n";
$self->echoer->ping();
}
}
Pinger->new()->run_all();
Jump to Line
Something went wrong with that request. Please try again.