diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-09-13 13:31:56 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-09-13 13:31:56 +0200 |
| commit | 3e3dc478fc9b4eb90681df89156dfcc8f7f81481 (patch) | |
| tree | b9788b0d48f524bc4c0aeeb48c744a8f7b097910 /eg/api.pl | |
| download | net-http-spore-3e3dc478fc9b4eb90681df89156dfcc8f7f81481.tar.gz | |
initial import
Diffstat (limited to 'eg/api.pl')
| -rw-r--r-- | eg/api.pl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/eg/api.pl b/eg/api.pl new file mode 100644 index 0000000..4e89701 --- /dev/null +++ b/eg/api.pl @@ -0,0 +1,24 @@ +use strict; +use warnings; +use 5.010; + +use Net::HTTP::Spore; + +my $username = shift; +my $token = shift; + +my $api = Net::HTTP::Spore->new_from_spec(shift); + +$api->enable('Net::HTTP::Spore::Middleware::Format::JSON'); + +$api->enable( + 'Net::HTTP::Spore::Middleware::Auth::Basic', + username => $username, + password => $token, +); + +my ( $content, $result ) = + $api->user_information( format => 'json', username => 'franckcuny' ); + +use YAML::Syck; +warn Dump $content; |
