| WWW-Facebook-FQL documentation | view source | Contained in the WWW-Facebook-FQL distribution. |
WWW::Facebook::FQL - Simple interface to Facebook's FQL query language
use WWW::Facebook::FQL;
## Connect and log in:
my $fb = new WWW::Facebook::FQL key => $public_key, private => $private_key;
$fb->login($email, $password);
## Get your own name and pic back:
$fb->query("SELECT name, pic FROM user WHERE uid=$fb->{uid}");
## Get your friends' names and pics:
$fb->query("SELECT name, pic FROM user WHERE uid IN "
. "(SELECT uid2 FROM friend WHERE uid1 = $fb->{uid})");
## Get results in manageable form:
use JSON::Syck; # or whatever...
$fb->format = 'JSON';
my $arrayref = JSON::Syck::Load $fb->query("...");
WWW::Facebook::FQL aims to make it easy to perform Facebook Query Language (FQL) queries from a Perl program, rather than to reflect the whole PHP Facebook API. For those comfortable with SQL, this may be a more comfortable interface. Results are currently returned in the raw JSON or XML format, but more palatable options may be available in the future.
$fb = new WWW::Facebook::FQL key => value, ...Create a new Facebook FQL session for user $EMAIL with password $PASS. Keyword arguments include
You need to sign up for this on Facebook by joining the "Developers" group and requesting an API key.
WWW::Facebook::FQL reads default values from the file $HOME/.fqlrc if
it exists. It should contain the innards of an argument list, and
will be evaluated like @args = eval "($FILE_CONTENTS)". The
constructor will not prompt for any parameters; it is the calling
program's responsibility to get sensitive information from the user in
an appropriate way.
$fb->logoutLog the current user out.
$result = $fb->query($QUERY)
>Perform FQL query $QUERY, returning the result in format $FORMAT (either XML or JSON, JSON by default). FQL is a lot like SQL, but with its own set of weird and privacy-related restrictions; for a description, see http://developers.facebook.com/documentation.php?v=1.0&doc=fql.
$fb->uid (read-only)$fb->email (read-only)$fb->verbose (read-write)$fb->format (read-write)%FIELDS -- table_name -> [fields]Map table names to available fields. This is particularly useful since FQL doesn't allow "SELECT *".
%IXFIELDS -- table_name -> [indexed_fields]Map table names to "indexable" fields, i.e. those fields that can be part of a WHERE clause.
%FIELDS and %IXFIELDS can be exported with the ':all' tag.
The canonical (PHP) API Documentation (http://developers.facebook.com/documentation.php), especially the FQL document (http://developers.facebook.com/documentation.php?v=1.0&doc=fql).
WWW::Facebook::API for bindings to the full API.
Since FQL is so much like SQL, it might be cool to make DBD::Facebook...
Sean O'Rourke, <seano@cpan.org>
Copyright (C) 2007 by Sean O'Rourke
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| WWW-Facebook-FQL documentation | view source | Contained in the WWW-Facebook-FQL distribution. |