summaryrefslogtreecommitdiff
path: root/lib/Net/HTTP/Console/Dispatcher/View.pm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/Net/HTTP/Console/Dispatcher/View.pm26
1 files changed, 26 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..9d623d7
--- /dev/null
+++ b/lib/Net/HTTP/Console/Dispatcher/View.pm
@@ -0,0 +1,26 @@
+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;