Debian Codegraph @

examples/facebook-desktop-json

raw
1 #!perl
2 use strict;
3 use warnings;
4 use WWW::Facebook::API;
5
6 my $client = WWW::Facebook::API->new(
7 desktop => 1,
8 throw_errors => 1,
9 parse => 1,
10 );
11
12 print "Enter your public API key: ";
13 chomp( my $val = <STDIN> );
14 $client->api_key($val);
15 print "Enter your API secret: ";
16 chomp( $val = <STDIN> );
17 $client->secret($val);
18
19 my $token = $client->auth->login( sleep => 20 );
20 $client->auth->get_session($token);
21
22 use Data::Dumper;
23 my $friends_perl = $client->friends->get;
24 print Dumper $friends_perl;
25
26 my $query = $client->fql->query(
27 query => 'SELECT name FROM user WHERE uid=' . $client->session_uid );
28 print Dumper $query;
29
30 my $notifications_perl = $client->notifications->get;
31 print Dumper $notifications_perl;
32
33 # Current user's quotes
34 my $quotes_perl = $client->users->get_info(
35 uids => $friends_perl,
36 fields => ['quotes']
37 );
38 print Dumper $quotes_perl;
39
40 $client->auth->logout;