Changeset 9820d55 for perl/modules/Facebook/lib/Facebook/Graph.pm
- Timestamp:
- Sep 19, 2011, 1:31:35 PM (13 years ago)
- Children:
- c104b43
- Parents:
- cfca761
- git-author:
- Edward Z. Yang <ezyang@mit.edu> (07/12/11 09:17:04)
- git-committer:
- Edward Z. Yang <ezyang@mit.edu> (09/19/11 13:31:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Facebook/lib/Facebook/Graph.pm
rcfca761 r9820d55 62 62 63 63 sub request_access_token { 64 my ($self, $code ) = @_;65 my $token =Facebook::Graph::AccessToken->new(64 my ($self, $code, $cb) = @_; 65 Facebook::Graph::AccessToken->new( 66 66 code => $code, 67 67 postback => $self->postback, 68 68 secret => $self->secret, 69 69 app_id => $self->app_id, 70 )->request; 71 $self->access_token($token->token); 72 return $token; 70 )->request(sub { 71 my ($response) = @_; 72 $self->access_token($response->token); 73 $cb->($response); 74 }); 73 75 } 74 76 75 77 sub convert_sessions { 76 my ($self, $sessions ) = @_;77 returnFacebook::Graph::Session->new(78 my ($self, $sessions, $cb) = @_; 79 Facebook::Graph::Session->new( 78 80 secret => $self->secret, 79 81 app_id => $self->app_id, 80 82 sessions => $sessions, 81 ) 82 ->request 83 ->as_hashref; 83 )->request($cb); # API change 84 84 } 85 85 … … 92 92 } 93 93 94 sub fetch { 95 my ($self, $object_name) = @_; 96 return $self->query->find($object_name)->request->as_hashref; 97 } 94 # XXX error handling 95 #sub fetch { 96 # my ($self, $object_name, $cb) = @_; 97 # $self->query->find($object_name)->request(sub { 98 # my ($result) = @_; 99 # $cb->($result->as_hashref); 100 # }); 101 #} 98 102 99 103 sub query { … … 540 544 L<Any::Moose> 541 545 L<JSON> 542 L<LWP> 543 L<LWP::Protocol::https> 546 L<AnyEvent::HTTP> 544 547 L<Mozilla::CA> 545 548 L<URI>
Note: See TracChangeset
for help on using the changeset viewer.