diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-06-06 16:52:32 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-06-06 16:52:32 +0200 |
| commit | 6754c25c01c202ff788ffba6265d98b4b75f4db4 (patch) | |
| tree | 8ec3b04963a14462a51479555381cdec361f5f43 /lib/Net/HTTP/Console/Role/DefaultMethod.pm | |
| download | net-http-console-6754c25c01c202ff788ffba6265d98b4b75f4db4.tar.gz | |
initial commit
Diffstat (limited to 'lib/Net/HTTP/Console/Role/DefaultMethod.pm')
| -rw-r--r-- | lib/Net/HTTP/Console/Role/DefaultMethod.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Net/HTTP/Console/Role/DefaultMethod.pm b/lib/Net/HTTP/Console/Role/DefaultMethod.pm new file mode 100644 index 0000000..c8f858e --- /dev/null +++ b/lib/Net/HTTP/Console/Role/DefaultMethod.pm @@ -0,0 +1,20 @@ +package Net::HTTP::Console::Role::DefaultMethod; + +use Moose::Role; +use JSON; +use Method::Signatures::Simple; +use namespace::autoclean; + +with qw/Net::HTTP::Console::Role::HTTP/; + +method from_lib { + my $input = shift; + $input =~ /^(\w+)\s(.*)$/; + my $method = $1; + my $args = $2; + my $o = $self->lib->new(); + my ($content, $response) = $o->$method(%{JSON::decode_json($args)}); + $self->_set_and_show($content, $response); +} + +1; |
