Ignore:
Timestamp:
Sep 19, 2011, 1:31:35 PM (13 years ago)
Author:
Edward Z. Yang <ezyang@mit.edu>
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)
Message:
Convert to async (both Facebook::Graph and us.)

Work items:
    - Documentation is all out of date
    - Think more carefully about error handling
      (right now it's delayed into the response object)
    - Really bad HTTP POST hack in Publish.pm.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Facebook/lib/Facebook/Graph/AccessToken.pm

    rcfca761 r9820d55  
    77use Facebook::Graph::AccessToken::Response;
    88with 'Facebook::Graph::Role::Uri';
    9 use LWP::UserAgent;
     9use AnyEvent::HTTP;
    1010
    1111has app_id => (
     
    4343
    4444sub request {
    45     my ($self) = @_;
    46     my $response = LWP::UserAgent->new->get($self->uri_as_string);
    47     return Facebook::Graph::AccessToken::Response->new(response => $response);
     45    my ($self, $cb) = @_;
     46    http_get $self->uri_as_string, sub {
     47        my ($response, $headers) = @_;
     48        $cb->(Facebook::Graph::AccessToken::Response->new(
     49            response => $response,
     50            headers => $headers,
     51            uri => $self->uri_as_string
     52        ));
     53    };
    4854}
    4955
Note: See TracChangeset for help on using the changeset viewer.