diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-06-08 15:22:36 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-06-08 15:22:36 +0200 |
| commit | 78fcbf54a4305e1ee6c3a105f91af40c7ea0a62a (patch) | |
| tree | c4eb6cec29a92076c2f6fc47ca318cbe59f5e0ba /lib/Net/HTTP/Console/Dispatcher.pm | |
| parent | update regex; modify http methods; .. (diff) | |
| download | net-http-console-78fcbf54a4305e1ee6c3a105f91af40c7ea0a62a.tar.gz | |
switch to MX::Declare; rename some roles and dispatcher
Diffstat (limited to '')
| -rw-r--r-- | lib/Net/HTTP/Console/Dispatcher.pm | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/Net/HTTP/Console/Dispatcher.pm b/lib/Net/HTTP/Console/Dispatcher.pm index 052e493..057f2d5 100644 --- a/lib/Net/HTTP/Console/Dispatcher.pm +++ b/lib/Net/HTTP/Console/Dispatcher.pm @@ -1,21 +1,22 @@ package Net::HTTP::Console::Dispatcher; -use Moose::Role; +use MooseX::Declare; -has application => (is => 'rw', isa => 'Net::HTTP::Console'); +role Net::HTTP::Console::Dispatcher { -requires qw/dispatch pattern/; + has application => (is => 'rw', isa => 'Net::HTTP::Console'); -around dispatch => sub { - my $orig = shift; - my $self = shift; - my $in = shift; + requires qw/dispatch pattern/; - if (my $r = $self->pattern($in)) { - return $self->$orig($r); - }else{ - return undef; - } -}; + around dispatch ($input) { + if (my $r = $self->pattern($input)) { + return $self->$orig($r); + } + else { + return undef; + } + }; + +} 1; |
