From 6754c25c01c202ff788ffba6265d98b4b75f4db4 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Sun, 6 Jun 2010 16:52:32 +0200 Subject: initial commit --- lib/Net/HTTP/Console/Dispatcher.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/Net/HTTP/Console/Dispatcher.pm (limited to 'lib/Net/HTTP/Console/Dispatcher.pm') diff --git a/lib/Net/HTTP/Console/Dispatcher.pm b/lib/Net/HTTP/Console/Dispatcher.pm new file mode 100644 index 0000000..052e493 --- /dev/null +++ b/lib/Net/HTTP/Console/Dispatcher.pm @@ -0,0 +1,21 @@ +package Net::HTTP::Console::Dispatcher; + +use Moose::Role; + +has application => (is => 'rw', isa => 'Net::HTTP::Console'); + +requires qw/dispatch pattern/; + +around dispatch => sub { + my $orig = shift; + my $self = shift; + my $in = shift; + + if (my $r = $self->pattern($in)) { + return $self->$orig($r); + }else{ + return undef; + } +}; + +1; -- cgit v1.2.3