Role::REST::ClientREST Client Role | |
Download |
Role::REST::Client Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Kaare Rasmussen
- Publisher web site:
- http://search.cpan.org/~kaare/
Role::REST::Client Tags
Role::REST::Client Description
Role::REST::Client is a REST client role that makes REST connectivity easy.Role::REST::Client will handle encoding and decoding when using the four HTTP verbs. GET PUT POST DELETECurrently Role::REST::Client supports these encodings application/json application/x-www-form-urlencoded application/xml application/yamlx-www-form-urlencoded only works for GET and POST, and only for encoding, not decoding.SYNOPSIS { package RESTExample; use Moose; with 'Role::REST::Client'; sub bar { my ($self) = @_; my $res = $self->post('foo/bar/baz', {foo => 'bar'}); my $code = $res->code; my $data = $res->data; return $data if $code == 200; } } my $foo = RESTExample->new( server => 'http://localhost:3000', type => 'application/json', clientattrs => {timeout => 5}, ); $foo->bar; # controller sub foo : Local { my ($self, $c) = @_; my $res = $c->model('MyData')->post('foo/bar/baz', {foo => 'bar'}); my $code = $res->code; my $data = $res->data; ... }Product's homepage
Role::REST::Client Related Software