Go Hagiwara > Facebook-OpenGraph-1.00 > Facebook::OpenGraph::Response

Download:
Facebook-OpenGraph-1.00.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source   Latest Release: Facebook-OpenGraph-1.22

NAME ^

Facebook::OpenGraph::Response - Response object for Facebook::OpenGraph.

SYNOPSIS ^

  my $res = Facebook::OpenGraph::Response->new(+{
      code        => $http_status_code,
      message     => $http_status_message,
      headers     => $response_headers,
      content     => $response_content,
      req_headers => $req_headers,
      req_content => $req_content,
      json        => JSON->new->utf8,
  });

DESCRIPTION ^

This handles response object for Facebook::OpenGraph.

METHODS ^

Class Methods

Facebook::OpenGraph::Response->new(\%args)

Creates and returns a new Facebook::OpenGraph::Response object.

%args can contain...

Instance Methods

$res->code

Returns HTTP status code

$res->message

Returns HTTP status message

$res->content

Returns response body

$res->req_headers

Returns request header. This is especially useful for debugging. You must install the later version of Furl to enable this or otherwise empty string will be returned. Also you have to specify Furl::HTTP->new(capture_request => 1) option.

$res->req_content

Returns request body. This is especially useful for debugging. You must install the later version of Furl to enable this or otherwise empty string will be returned. Also you have to specify Furl::HTTP->new(capture_request => 1) option.

$res->is_success

Returns if status is 2XX or 304. 304 is added to handle $fb->fetch_with_etag();

$res->error_string

Returns error string.

$res->as_json

Returns response content as JSON string. Most of the time the response content itself is JSON formatted so it basically returns response content without doing anything. When Graph API returns plain text just saying 'true' or 'false,' it turns the content into JSON format like '{"success" : "(true|false)"}' so you can handle it in the same way as other cases.

$res->as_hashref

Returns response content in hash reference.

$res->is_modified

Returns if target object is modified. This method is called in $fb->fetch_with_etag().

syntax highlighting: