From 85a634ef2e68115636e8a17becbc6a968cab0eae Mon Sep 17 00:00:00 2001 From: franck cuny Date: Tue, 12 Oct 2010 17:18:25 +0200 Subject: update POD --- lib/Net/HTTP/Spore.pm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'lib/Net/HTTP/Spore.pm') diff --git a/lib/Net/HTTP/Spore.pm b/lib/Net/HTTP/Spore.pm index b510fa0..23d5bc5 100644 --- a/lib/Net/HTTP/Spore.pm +++ b/lib/Net/HTTP/Spore.pm @@ -100,20 +100,36 @@ sub _add_methods { my $client = Net::HTTP::Spore->new_from_spec('twitter.json'); - $client->enable('Auth::OAuth'); $client->enable('Format::JSON'); + $client->enable('Auth::OAuth'); my $timeline = $client->public_timeline(format => 'json'); my $tweets = $timeline->body; + foreach my $tweet (@$tweets) { - print $tweet->{user}->{screen_name}. " says ".$tweet->{text}."\n"; - } + print $tweet->{user}->{screen_name}. " says ".$tweet->{text}."\n"; } my $friends_timeline = $client->friends_timeline(format => 'json'); =head1 DESCRIPTION +This module is an implementation of the SPORE specification. To use this client, you need to use or to write a SPORE specification of an API. Some specifications are available L. + +=head2 CLIENT CREATION + +First you need to create a client. This can be done using two methods, B and B. The client will read the specification file to create a appropriate methods to interact with the API. + +=head2 MIDDLEWARES + +It's possible to activate some middlewares to extend the usage of the client. If you're using an API that discuss in JSON, you can enable the middleware L. + + $client->enable('Format::JSON'); + +or only on some path + + $client->enable_if(sub{$_->[0]->path =~ m!/path/to/json/stuff!}, 'Format::JSON'); + =head2 METHODS =over 4 -- cgit v1.2.3