Use Facebook::Graph to write desktop application

Use Facebook::Graph to write desktop application

Topic: Use Facebook::Graph to write desktop application

Using Facebook::Graph Perl CPAN module to read/write data of Facebook.

8327d09b0bd5ac97409aa10f927b3c30?s=128

Gea-Suan Lin

August 24, 2012
Tweet

Transcript

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

  2. Common $fb

  3. my $fb = Facebook::Graph->new( app_id => APP_ID, secret => SECRET,

    postback => ‘http://www.mysite.com/’ );
  4. First to authorize

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

  6. Open browser to authorize

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

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

  9. You’ll get your token

  10. $fb->access_token($token);

  11. After authorizing...

  12. my $fb = Facebook::Graph->new( app_id => APP_ID, secret => SECRET,

    postback => ‘http://www.mysite.com/’ ); $fb->access_token($token);
  13. Then, post something...

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

  15. And, read something...

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

  17. References

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

  19. Thanks !