From d0958fca7e5b21131857f40c1aac60a59893ed63 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Tue, 8 Jun 2010 18:01:03 +0200 Subject: fix loading lib; rename print to message --- lib/Net/HTTP/Console/Dispatcher/Help.pm | 58 ++++++++++++++++----------------- lib/Net/HTTP/Console/Dispatcher/Set.pm | 4 +-- lib/Net/HTTP/Console/Dispatcher/View.pm | 2 +- 3 files changed, 32 insertions(+), 32 deletions(-) (limited to 'lib/Net/HTTP/Console/Dispatcher') diff --git a/lib/Net/HTTP/Console/Dispatcher/Help.pm b/lib/Net/HTTP/Console/Dispatcher/Help.pm index 6218676..3868d73 100644 --- a/lib/Net/HTTP/Console/Dispatcher/Help.pm +++ b/lib/Net/HTTP/Console/Dispatcher/Help.pm @@ -4,6 +4,10 @@ use MooseX::Declare; class Net::HTTP::Console::Dispatcher::Help with Net::HTTP::Console::Dispatcher { + method pattern($input) { + $input =~ /^help/ ? return $input : return 0; + } + method dispatch($input) { (my $cmd, my $cmd_name) = $input =~ /^help\s(\w+)?\s?(\w+)?/; @@ -29,10 +33,6 @@ class Net::HTTP::Console::Dispatcher::Help with Net::HTTP::Console::Dispatcher { 1; } - method pattern($input) { - $input =~ /^help/ ? return $input : return 0; - } - method _display_help { print <application->api_object->meta->get_all_net_api_methods(); - - if (!@methods) { - print "no method available\n"; - return; - } - - print "available commands:\n"; - map { print "- " . $_ . "\n" } @methods; - } - - method _get_help_for_command($cmd_name) { - my $method = - $self->application->api_object->meta->find_net_api_method_by_name($cmd_name); - - if (!$method) { - print "unknown method " . $cmd_name . "\n"; - return; - } - - print $method->documentation; - } - method _help_about_view { print <application->api_object->meta->get_all_net_api_methods(); + + if (!@methods) { + print "no method available\n"; + return; + } + + print "available commands:\n"; + map { print "- " . $_ . "\n" } @methods; + } + + method _get_help_for_command($cmd_name) { + my $method = + $self->application->api_object->meta->find_net_api_method_by_name($cmd_name); + + if (!$method) { + print "unknown method " . $cmd_name . "\n"; + return; + } + + print $method->documentation; + } } 1; diff --git a/lib/Net/HTTP/Console/Dispatcher/Set.pm b/lib/Net/HTTP/Console/Dispatcher/Set.pm index d514f37..c72b09b 100644 --- a/lib/Net/HTTP/Console/Dispatcher/Set.pm +++ b/lib/Net/HTTP/Console/Dispatcher/Set.pm @@ -21,12 +21,12 @@ class Net::HTTP::Console::Dispatcher::Set with Net::HTTP::Console::Dispatcher { method _set_header($header, $value) { $self->application->set_header($header, $value); - $self->application->print("header $header set to $value"); + $self->application->message("header $header set to $value"); } method _unset_header($header) { $self->application->delete_header($header); - $self->application->print("header $header unset"); + $self->application->message("header $header unset"); } } diff --git a/lib/Net/HTTP/Console/Dispatcher/View.pm b/lib/Net/HTTP/Console/Dispatcher/View.pm index 5b52fc0..bfc50f0 100644 --- a/lib/Net/HTTP/Console/Dispatcher/View.pm +++ b/lib/Net/HTTP/Console/Dispatcher/View.pm @@ -19,7 +19,7 @@ class Net::HTTP::Console::Dispatcher::View with Net::HTTP::Console::Dispatcher { } elsif ($key eq 'defined_headers') { foreach ($self->application->all_headers) { - $self->application->print( $_->[0] . ': ' . $_->[1]); + $self->application->message( $_->[0] . ': ' . $_->[1]); } } } -- cgit 1.4.1