WWW-Facebook-FQL

 view release on metacpan or  search on metacpan

FQL.pm  view on Meta::CPAN

package WWW::Facebook::FQL;

=head1 NAME

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

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

=head1 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.

=cut

use URI::Escape;
use WWW::Mechanize;
use Digest::MD5 qw(md5_hex);
require Exporter;
use strict;

use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
$VERSION = '0.03';

@EXPORT_OK = qw(%FIELDS %IXFIELDS);
%EXPORT_TAGS = (all => \@EXPORT_OK);
@ISA = qw(Exporter);

use vars qw($rest %FIELDS %IXFIELDS);
$rest = 'http://api.facebook.com/restserver.php';

sub dprint
{
    my $self = shift;
    my $lev = shift;
    if ($lev <= $self->{verbose}) {
        print STDERR @_;
    }
}

sub _sig
{
    my $secret = shift;
    md5_hex uri_unescape(join '', sort(@_), $secret);
}

sub get
{
    my $self = shift;
    ($self->{mech} ||= new WWW::Mechanize)->get(@_);

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.395 second using v1.00-cache-2.02-grep-82fe00e-cpan-f73e49a70403 )