diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-06-08 17:30:55 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-06-08 17:33:00 +0200 |
| commit | 2bb154b2b3bbe819c98a01d9d43f2183e6389401 (patch) | |
| tree | 1a304667863e5feb12c543dfbb72a579e88901c9 /lib/Net/HTTP/Console/Dispatcher/View.pm | |
| parent | move code to appropriate role (diff) | |
| download | net-http-console-2bb154b2b3bbe819c98a01d9d43f2183e6389401.tar.gz | |
add dispatcher for viewing content; update help
Diffstat (limited to 'lib/Net/HTTP/Console/Dispatcher/View.pm')
| -rw-r--r-- | lib/Net/HTTP/Console/Dispatcher/View.pm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Net/HTTP/Console/Dispatcher/View.pm b/lib/Net/HTTP/Console/Dispatcher/View.pm new file mode 100644 index 0000000..059fe53 --- /dev/null +++ b/lib/Net/HTTP/Console/Dispatcher/View.pm @@ -0,0 +1,28 @@ +package Net::HTTP::Console::Dispatcher::View; + +use MooseX::Declare; + +class Net::HTTP::Console::Dispatcher::View with Net::HTTP::Console::Dispatcher { + + method pattern ($input) { + $input =~ /^show/ ? return $input : return 0; + } + + method dispatch ($input) { + (my $key) = $input =~ /^show ([\w]+)/; + + if ($key eq 'headers') { + $self->application->_show_last_headers; + } + elsif ($key eq 'content') { + $self->application->_show_last_content; + } + elsif ($key eq 'defined_headers') { + foreach ($self->application->all_headers) { + print $_->[0] . ': ' . $_->[1] . "\n"; + } + } + } +} + +1; |
