diff options
Diffstat (limited to '')
| -rw-r--r-- | lib/Net/HTTP/Console/Dispatcher.pm | 21 |
1 files changed, 21 insertions, 0 deletions
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; |
