NAME
WWW::Facebook::API::REST::Client - Facebook API implementation
VERSION
This document describes WWW::Facebook::API::REST::Client version 0.0.3
SYNOPSIS
use WWW::Facebook::API::REST::Client;
my $client = WWW::Facebook::API::REST::Client->new(
throw_errors => 1,
desktop => 1,
api_key => '5ac7d432',
secret => '459ade099c',
);
my $token = $client->auth->create_token->{result}->[0]->{token}->[0];
$client->login->login($token); # prompts for email and password from STDIN
$client->auth->get_session($token);
my @friends = @{$client->friends->get->{result}->[0]->{result_elt}};
$client->friends->are_friends([@friends[0,1,2,3]], [@friends[4,5,6,7]]);
print 'You have '.$client->pokes->get_count->{result}->[0]->{unseen}->[0]
.' new poke(s).';
my @quotes = map { @{$_->{quote}} }
values %{$client->users->get_info(\@friends, 'quote')->{result}->[0]->{result_elt}};
print 'A lot of quotes: '.@quotes."\n";
print "Random one:\t".$quotes[int rand @quotes]."\n";
DESCRIPTION
A Perl implementation of the Facebook API, working off of the Java and PHP implementations initially proffered by the Facebook development team. The results are returned as a hash parsed by XML::Simple with ForceArray => 1 and KeepRoot => 1. So, as per the API description at http://developers.facebook.com/documentation.php, there's a result key, with an array which has the result items (be they hashes or whatever) inside. I thought this would give the most direct access to the actual data without filtering any important data (or ordering of data) out.
SUBROUTINES/METHODS
- auth
-
auth namespace of the API (See WWW::Facebook::API::REST::Client::Auth). All method names from the Facebook API are lower_cased istead of CamelCase, e.g., auth.createToken is auth->create_token
- login
-
Not defined in the API, but useful for testing with your own account. Asks for username and password (not stored) to authenticate token. Called as $client->login->login($token);
- events
-
events namespace of the API (See WWW::Facebook::API::REST::Client::Events). All method names from the Facebook API are lower_cased istead of CamelCase, e.g., events.getInWindow is events->get_in_window
- friends
-
friends namespace of the API (See WWW::Facebook::API::REST::Client::Friends). All method names from the Facebook API are lower_cased istead of CamelCase, e.g., friends.areFriends(list1, list2) is friends->are_friends(list1, list2)
- messages
-
messages namespace of the API (See WWW::Facebook::API::REST::Client::Messages). All method names from the Facebook API are lower_cased istead of CamelCase, e.g., messages.getCount is message->get_count
- photos
-
photos namespace of the API (See WWW::Facebook::API::REST::Client::Photos). All method names from the Facebook API are lower_cased istead of CamelCase, e.g., photos.getOfUser is photos->get_of_user
- pokes
-
pokes namespace of the API (See WWW::Facebook::API::REST::Client::Pokes). All method names from the Facebook API are lower_cased istead of CamelCase, e.g., pokes.getCount is pokes->get_count
- users
-
users namespace of the API (See WWW::Facebook::API::REST::Client::Users). All method names from the Facebook API are lower_cased istead of CamelCase, e.g., users.getInfo is users->get_info
- wall
-
wall namespace of the API (See WWW::Facebook::API::REST::Client::Wall). All method names from the Facebook API are lower_cased istead of CamelCase, e.g., wall.getCount is wall->get_count
DIAGNOSTICS
The errors that are thrown would most likely be from WWW::Facebook::API::REST::Client::Base or from DEPENDENCIES, so look there first.
CONFIGURATION AND ENVIRONMENT
WWW::Facebook::API::REST::Client requires no configuration files or environment variables.
DEPENDENCIES
Moose WWW::Mechanize XML::Simple Digest::MD5 Time::HiRes URI::Escape
INCOMPATIBILITIES
None.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-www-facebook-api-rest-client@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
AUTHOR
David Romano <unobe@cpan.org>
LICENSE AND COPYRIGHT
Copyright (c) 2006, David Romano <unobe@cpan.org>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.