Slide 1

Slide 1 text

Use Facebook::Graph to write desktop application Gea-Suan Lin

Slide 2

Slide 2 text

Common $fb

Slide 3

Slide 3 text

my $fb = Facebook::Graph->new( app_id => APP_ID, secret => SECRET, postback => ‘http://www.mysite.com/’ );

Slide 4

Slide 4 text

First to authorize

Slide 5

Slide 5 text

my @perms = qw/publish_stream read_stream/; say $fb ->authorize ->extend_permission(@perms) ->uri_as_string;

Slide 6

Slide 6 text

Open browser to authorize

Slide 7

Slide 7 text

Then copy “code” value to the following code...

Slide 8

Slide 8 text

my $r = $fb-> request_access_token('*code*'); say $r->token;

Slide 9

Slide 9 text

You’ll get your token

Slide 10

Slide 10 text

$fb->access_token($token);

Slide 11

Slide 11 text

After authorizing...

Slide 12

Slide 12 text

my $fb = Facebook::Graph->new( app_id => APP_ID, secret => SECRET, postback => ‘http://www.mysite.com/’ ); $fb->access_token($token);

Slide 13

Slide 13 text

Then, post something...

Slide 14

Slide 14 text

$fb ->add_post ->to(‘195466193802264’) ->set_message(‘test’) ->publish;

Slide 15

Slide 15 text

And, read something...

Slide 16

Slide 16 text

use Data::Dumper; print Dumper $fb->query ->find(‘195466193802264/feed’) ->request ->as_hashref;

Slide 17

Slide 17 text

References

Slide 18

Slide 18 text

Facebook::Graph http://goo.gl/Ym5KA

Slide 19

Slide 19 text

Thanks !