NAME

WWW::Facebook::FQL - Simple interface to Facebook's FQL query language

SYNOPSIS

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("...");

DESCRIPTION

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

email -- the email address of your Facebook account.
pass -- your password.
verbose -- A number controlling debugging information.
key -- The public part of your API key.

You need to sign up for this on Facebook by joining the "Developers" group and requesting an API key.

private -- The private part of your API key.
format -- Data return format, either 'XML' (the default) or 'JSON'.

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->logout

Log 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.

ACCESSORS

$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.

EXPORTS

%FIELDS and %IXFIELDS can be exported with the ':all' tag.

SEE ALSO

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.

BUGS and TODO

Since FQL is so much like SQL, it might be cool to make DBD::Facebook...

AUTHOR

Sean O'Rourke, <seano@cpan.org>

COPYRIGHT AND LICENSE

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 227:

Unterminated C<...> sequence