blob: 2036b474d05de143cd445a6bb4adff31fd5ce1f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package Net::HTTP::Console; # For PAUSE
our $VERSION = 0.01;
use MooseX::Declare;
class Net::HTTP::Console {
use Try::Tiny;
with 'MooseX::Getopt';
with 'Net::HTTP::Console::Role::Headers';
with 'Net::HTTP::Console::Role::Prompt';
with 'Net::HTTP::Console::Role::Plugins';
with 'Net::HTTP::Console::Role::API';
with 'Net::HTTP::Console::Role::HTTP::Response';
has url => (isa => 'Str', is => 'rw', predicate => 'has_url');
has format => (isa => 'Str', is => 'rw', predicate => 'has_format');
has format_mode => (isa => 'Str', is => 'rw', predicate => 'has_format_mode');
method dispatch ($input) {
my $result;
try {
foreach ($self->all_plugins) {
last if ($result = $_->dispatch($input));
}
}catch{
print "[ERROR]: ".$_;
};
}
method new_anonymous_method ($http_method, $path) {
$self->api_object->meta->add_net_api_method(
'anonymous',
method => $http_method,
path => $path,
);
}
}
1;
|