Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (33 sloc) 0.621 kb
#!/usr/bin/env perl
# vim: ts=2 sw=2 noexpandtab
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';
use Reflex::Trait::Watched qw(watches);
watches echoer => (
isa => 'Echoer',
default => sub { Echoer->new() },
);
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.