Skip to content

Instantly share code, notes, and snippets.

@lestrrat
Created September 18, 2009 07:36
Show Gist options
  • Save lestrrat/188926 to your computer and use it in GitHub Desktop.
Save lestrrat/188926 to your computer and use it in GitHub Desktop.
package Acme::Morse;
use Moose::Role;
requires 'print_output';
sub encode {
my ($self, $thing) = @_;
my $morse = ....; # 変換
$self->print_output($morse);
}
package Acme::Morse::Handle;
use Moose;
with 'Acme::Morse';
has handle => ( is => 'ro', isa => 'GlobRef' );
sub print_output {
my ($self, $thing) = @_;
print $self->handle $thing;
}
package Acme::Morse::Flash;
use Moose;
sub print_output {
my ($self, $thing) = 2_;
AnyEvent->timer ....;
}
package main;
my $x = Acme::Morse::Flast->new( ... );
$x->encode( "poop" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment