<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    WWW::Facebook::API - Facebook API implementation

VERSION
    This document describes WWW::Facebook::API version 0.3.4

SYNOPSIS
        use WWW::Facebook::API;

        my $client = WWW::Facebook::API-&gt;new(
            desktop        =&gt; 1,
            throw_errors   =&gt; 1,
            parse          =&gt; 1,
        );
    
        print "Enter your public API key: ";
        chomp( my $val = &lt;STDIN&gt; );
        $client-&gt;api_key($val);
        print "Enter your API secret: ";
        chomp($val = &lt;STDIN&gt; );
        $client-&gt;secret($val);
    
        print "Enter your e-mail address: ";
        chomp(my $email = &lt;STDIN&gt; );
        $client-&gt;secret($val);
        print "Enter your password: ";
        chomp(my $pass = &lt;STDIN&gt; );
    
        my $token = $client-&gt;auth-&gt;login( email =&gt; $email,  pass =&gt; $pass );
        $client-&gt;auth-&gt;get_session( $token );
    
        use Data::Dumper;
        my $friends_perl = $client-&gt;friends-&gt;get;
        print Dumper $friends_perl;
    
        my $notifications_perl = $client-&gt;notifications-&gt;get;
        print Dumper $notifications_perl;
    
        # Current user's quotes
        my $quotes_perl = $client-&gt;users-&gt;get_info(
            uids   =&gt; $friends_perl,
            fields =&gt; ['quotes']
        );
        print Dumper $quotes_perl;
    
        $client-&gt;auth-&gt;logout;

DESCRIPTION
    A Perl implementation of the Facebook API, working off of the canonical
    Java and PHP implementations. By default it uses JSON::Any to parse the
    response returned by Facebook's server. There is an option to return the
    raw response in either XML or JSON (See the "parse" method below).

SUBROUTINES/METHODS
    new( %params )
        Returns a new instance of this class. You are able to pass in any of
        the attribute method names in WWW::Facebook::API to set its value:

            my $client = WWW::Facebook::API-&gt;new(
                parse           =&gt; 1,
                format          =&gt; 'JSON',
                secret          =&gt; 'application_secret_key',
                api_key         =&gt; 'application_key',
                session_key     =&gt; 'session_key',
                session_expires =&gt; 'session_expires',
                session_uid     =&gt; 'session_uid',
                desktop         =&gt; 1,
                api_version     =&gt; '1.0',
                callback        =&gt; 'callback_url',
                next            =&gt; 'next',
                popup           =&gt; 'popup',
                skipcookie      =&gt; 'skip_cookie',
            );
            $copy = $client-&gt;new;

NAMESPACE METHODS
    All method names from the Facebook API are lower_cased instead of
    CamelCase.

    auth
        For desktop apps, these are synonymous:

            $client-&gt;auth-&gt;get_session( $client-&gt;auth-&gt;create_token );
            $client-&gt;auth-&gt;get_session;

        And that's all you really have to do (but see
        WWW::Facebook::API::Auth for details about opening a browser on *nix
        for Desktop apps). "get_session" automatically sets "session_uid",
        "session_key", and "session_expires" for $client. It returns
        nothing.

        If the desktop attribute is set to false the $token must be the
        auth_token returned from Facebook to your web app for that user:

            if ( $q-&gt;param('auth_token')  ) {
                $client-&gt;auth-&gt;get_session( $q-&gt;param('auth_token') );
            }

        "get_session" automatically sets "session_uid", "session_key", and
        "session_expires" for $client. It returns nothing.

        See WWW::Facebook::API::Auth for details.

    canvas
        Work with the canvas. See WWW::Facebook::API::Canvas.

            $response = $client-&gt;canvas-&gt;get_user( $q )
            $response = $client-&gt;canvas-&gt;get_fb_params( $q )
            $response = $client-&gt;canvas-&gt;validate_sig( $q )
            $response = $client-&gt;canvas-&gt;in_fb_canvas( $q )
            $response = $client-&gt;canvas-&gt;in_frame( $q )

    events
        events namespace of the API (See WWW::Facebook::API::Events). All
        method names from the Facebook API are lower_cased instead of
        CamelCase:

            $response = $client-&gt;events-&gt;get( uid =&gt; 234233, eids =&gt; [23,2343,54545] );
            $response = $client-&gt;events-&gt;get_members( eid =&gt; 233 );

    fbml
        fbml namespace of the API (See WWW::Facebook::API::FBML): All method
        names from the Facebook API are lower_cased instead of CamelCase:

            $response = $client-&gt;fbml-&gt;set_ref_handle( handle =&gt; '', fbml =&gt; '');
            $response = $client-&gt;fbml-&gt;refresh_img_src( url =&gt; '');
            $response = $client-&gt;fbml-&gt;refresh_ref_url( url =&gt; '');

    fql fql namespace of the API (See WWW::Facebook::API::FQL):

            $response = $client-&gt;fql-&gt;query( query =&gt; 'FQL query' );

    feed
        feed namespace of the API (See WWW::Facebook::API::Feed). All method
        names from the Facebook API are lower_cased instead of CamelCase:

            $response 
                = $client-&gt;feed-&gt;publish_story_to_user(
                    title   =&gt; 'title',
                    body    =&gt; 'markup',
                    priority =&gt; 5,
                    ...
            );
            $response 
                = $client-&gt;feed-&gt;publish_action_of_user(
                    title   =&gt; 'title',
                    body    =&gt; 'markup',
                    priority =&gt; 7,
                    ...
            );

    friends
        friends namespace of the API (See WWW::Facebook::API::Friends). All
        method names from the Facebook API are lower_cased instead of
        CamelCase:

            $response = $client-&gt;friends-&gt;get;
            $response = $client-&gt;friends-&gt;get_app_users;
            $response
                = $client-&gt;friends-&gt;are_friends( uids1 =&gt; [1,5,8], uids2 =&gt; [2,3,4] );

    groups
        groups namespace of the API (See WWW::Facebook::API::Groups). All
        method names from the Facebook API are lower_cased instead of
        CamelCase:

            $response = $client-&gt;groups-&gt;get( uid =&gt; 234324, gids =&gt; [2423,334] );
            $response = $client-&gt;groups-&gt;get_members( gid =&gt; 32 );

    notifications
        notifications namespace of the API (See
        WWW::Facebook::API::Notifications). All method names from the
        Facebook API are lower_cased instead of CamelCase:

            $response = $client-&gt;notifications-&gt;get;
            $response = $client-&gt;notifications-&gt;send(
                to_ids =&gt; [ 1, 3 ],
                markup =&gt; 'markup',
                no_email =&gt; 1,
            );
            $response = $client-&gt;notifications-&gt;send_request(
                to_ids =&gt; [ 1, 2 ],
                type =&gt; 'event',
                content =&gt; 'markup',
                image   =&gt; 'image url',
                invite  =&gt; 0|1,
            );

    photos
        photos namespace of the API (See WWW::Facebook::API::Photos). All
        method names from the Facebook API are lower_cased instead of
        CamelCase:

            $response = $client-&gt;photos-&gt;add_tag(
                    pid =&gt; 2,
                    tag_uid =&gt; 3,
                    tag_text =&gt; "me",
                    x =&gt; 5,
                    y =&gt; 6
                );
            $response = $client-&gt;photos-&gt;create_album(
                    name =&gt; 'fun in the sun',
                    location =&gt; 'California',
                    description =&gt; "Summer '07",
            );
            $response = $client-&gt;photos-&gt;get( aid =&gt; 2, pids =&gt; [4,7,8] );
            $response = $client-&gt;photos-&gt;get_albums( uid =&gt; 1, pids =&gt; [3,5] );
            $response = $client-&gt;photos-&gt;get_tags( pids =&gt; [4,5] );
            $response = $client-&gt;photos-&gt;upload(
                aid =&gt; 5,
                caption =&gt; 'beach',
                data =&gt; 'raw data',
            );

    profile
        profile namespace of the API (See WWW::Facebook::API::Profile). All
        method names from the Facebook API are lower_cased instead of
        CamelCase:

            $response = $client-&gt;profile-&gt;get_fbml( uid =&gt; 3 );
            $response = $client-&gt;profile-&gt;set_fbml( uid =&gt; 5, markup =&gt; 'markup' );

    update
        update namespace of the API (See WWW::Facebook::API::Update). All
        method names from the Facebook API are lower_cased instead of
        CamelCase:

            $response = $client-&gt;update-&gt;decode_ids( ids =&gt; [5,4,3] );

    users
        users namespace of the API (See WWW::Facebook::API::Users). All
        method names from the Facebook API are lower_cased instead of
        CamelCase:

            $response = $client-&gt;users-&gt;get_info(
                uids =&gt; [12,453,67],
                fields =&gt; ['quotes','activities','books']
            );

ATTRIBUTE METHODS
    These are methods to get/set the object's attributes.

    api_key( $new_api_key )
        The developer's API key. See the Facebook API documentation.

    api_version( $new_version )
        Which version to use (default is "1.0", which is the only one
        supported currently. Corresponds to the argument "v" that is passed
        in to methods as a parameter.

    app_path()
        If using the Facebook canvas, the path to your application. For
        example if your application is at http://apps.facebook.com/example/
        this should be "example".

    apps_uri()
        The apps uri for Facebook apps. The default is
        http://apps.facebook.com/.

    callback( $new_default_callback )
        The callback URL for your application. See the Facebook API
        documentation. Just a convenient place holder for the value.

    call_success( $is_success, $error_message )
        Takes in two values, the first setting the object's
        last_call_success attribute, and the second setting the object's
        last_error attribute. Returns an array reference containing the
        last_call_success and last_error values, in that order:

            my $response = $client-&gt;call_success( 1, undef );
            if ( $response-&gt;[0] == 1 ) {
                print 'Last call successful';
            }
            if ( not defined $response-&gt;[1] ) {
                print 'Error message is undefined';
            }

            $client-&gt;call_success( 0,'2: The service is not available at this time.');

            $response = $client-&gt;call_success;
            if ( not $response-&gt;[0] ) {
                print 'Last call unsuccessful';
            }
            if ( not defined $response-&gt;[1] ) {
                print "Error $response-&gt;[1]";
            }

        The "call" method calls this method, and shouldn't need to be called
        to set anything, just to get the value later if "throw_errors" is
        false.

    debug(0|1)
        A boolean set to either true or false, determining if debugging
        messages should be carped for REST calls. Defaults to 0.

    desktop(0|1)
        A boolean signifying if the client is being used for a desktop
        application. Defaults to 0. See the Facebook API documentation.

    format('JSON'|'XML')
        The default format to use if none is supplied with an API method
        call. Currently available options are XML and JSON. Defaults to
        JSON.

    last_call_success(1|0)
        A boolean set to true or false, to show whether the last call was
        succesful or not. Called by "call_success". Defaults to 1.

    last_error( $error_message )
        A string holding the error message of the last failed call to the
        REST server. Called by "call_success". Defaults to undef.

    next( $new_default_next_url )
        See the Facebook API documentation's Authentication Guide. Just a
        convenient place holder for the value.

    parse(1|0)
        Defaults to 1. If set to true, the response returned by each method
        call will be a Perl structure (see each method for the structure it
        will return). If it is set to 0, the response string from the server
        will be returned. (The response string is unescaped if the 'desktop'
        attribute is false).

    popup( $popup )
        See the Facebook API documentation's Authentication Guide. Just a
        convenient place holder for the value.

    secret( $new_secret_key )
        For a desktop application, this is the secret that is used for
        calling "auth-"create_token&gt; and "auth-"get_session&gt;. See the
        Facebook API documentation under Authentication.

    server_uri( $new_server_uri )
        The server uri to access the Facebook REST server. Default is
        'http://api.facebook.com/restserver.php'. Used to make calls to the
        Facebook server, and useful for testing. See the Facebook API
        documentation.

    session_expires( $new_expires )
        The session expire timestamp for the client's user. Automatically
        set when "$client-"auth-&gt;get_session&gt; is called. See the Facebook
        API documentation.

    session_key( $new_key )
        The session key for the client's user. Automatically set when
        "$client-"auth-&gt;get_session&gt; is called. See the Facebook API
        documentation.

    session_uid( $new_uid )
        The session's uid for the client's user. Automatically set when
        "$client-"auth-&gt;get_session&gt; is called. See the Facebook API
        documentation.

    skipcookie(0|1)
        See the Facebook API documentation's Authentication Guide. Just a
        convenient place holder for the value.

    throw_errors(0|1)
        A boolean set to either true of false, signifying whether or not to
        "confess" when an error is returned from the REST server.

    ua  The LWP::UserAgent agent used to communicate with the REST server.
        The agent_alias is initially set to "Perl-WWW-Facebook-API/0.3.4".

PUBLIC METHODS
    call( $method, %args )
        The method which other submodules within WWW::Facebook::API use to
        call the Facebook REST interface. It takes in a string signifying
        the method to be called (e.g., 'auth.getSession'), and key/value
        pairs for the parameters to use: $client-&gt;call( 'auth.getSession',
        auth_token =&gt; 'b3324235e' );

    generate_sig( params =&gt; $params_hashref, secret =&gt; $secret )
        Generates a sig when given a parameters hash reference and a secret
        key.

    get_facebook_url( $subdomain )
        Returns the URL to Facebook. You can specifiy a specific network as
        a parameter:

            $response = $client-&gt;get_facebook_url( 'apps' );
            print $response;    # prints http://apps.facebook.com

    get_add_url( %params)
        Returns the URL to add your application with the parameters (that
        are given) included. Note that the API key and the API version
        parameters are also included automatically. If the "next" parameter
        is passed in, it's string-escaped. Used for platform applications:

            $response = $client-&gt;get_add_url( next =&gt; 'http://my.website.com' );

            # prints http://www.facebook.com/app.php?api_key=key&amp;v=1.0
            #        &amp;next=http%3A%2F%2Fmy.website.com
            print $response;

    get_infinite_session_url()
        Returns the URL for the user to generate an infinite session for
        your application:

            $response = $client-&gt;get_infinite_session_url;

            # prints http://www.facebook.com/codegen.php?api_key=key&amp;v=1.0
            print $response;

    get_login_url( %params )
        Returns the URL to login to your application with the parameters
        (that are defined) included. If the "next" parameter is passed in,
        it's string-escaped:

            $response = $client-&gt;get_login_url( next =&gt; 'http://my.website.com' );

            # prints http://www.facebook.com/login.php?api_key=key&amp;v=1.0
            #        &amp;next=http%3A%2F%2Fmy.website.com
            print $response;

    get_app_url
        Returns the URL to your application, if using the Facebook canvas.
        Uses &lt;$client-&gt;app_path&gt;, which you have to set yourself (See
        &lt;app_path&gt; below).

    log_string($params_hashref, $response)
        Pass in the params and the response from a call, and it will make a
        formatted string out of it showing the parameters used, and the
        response received.

    session( uid =&gt; $uid, key =&gt; $session_key, expires =&gt; $session_expires )
        Sets the "user", "session_key", and "session_expires" all at once.

    unescape_string($escaped_string)
        Returns its parameter with all the escape sequences unescaped. If
        you're using a web app, this is done automatically to the response.

    verify_sig( sig =&gt; $expected_sig, params =&gt; $params_hashref )
        Checks the signature for a given set of parameters against an
        expected value.

PRIVATE METHODS
    _add_url_params( %params )
        Called by both "get_login_url" and "get_add_url" to process any of
        their parameters. Prepends the api_key and the version number as
        parameters and returns the parameter string.

    _check_values_of($params_hashref)
        Makes sure all the values of the $params_hashref that need to be set
        are set. Uses the defaults for those values that are needed and not
        supplied.

    _format_params($params_hashref)
        Format parameters according to Facebook API specification.

    _post_request( $params_hashref, $secret )
        Used by "call" to post the request to the REST server and return the
        response.

    _parse($string)
        Parses the response from a call to the Facebook server to make it a
        Perl data structure, and returns the result.

DIAGNOSTICS
    " Unable to load JSON module for parsing: %s "
        JSON::Any was not able to load one of the JSON modules it uses to
        parse JSON. Please make sure you have one (of the several) JSON
        modules it can use installed.

    " Error during REST call: %s "
        This means that there's most likely an error in the server you are
        using to communicate to the Facebook REST server. Look at the
        traceback to determine why an error was thrown. Double-check that
        "server_uri" is set to the right location.

    " Cannot create subclass %s: %s "
        Cannot create the needed subclass method. Contact the developer to
        report.

    " Cannot create attribute %s: %s "
        Cannot create the needed attribute method. Contact the developer to
        report.

CONFIGURATION AND ENVIRONMENT
    WWW::Facebook::API requires no configuration files or environment
    variables.

DEPENDENCIES
    version Crypt::SSLeay Digest::MD5 JSON::Any Time::HiRes LWP::UserAgent

INCOMPATIBILITIES
    None.

BUGS AND LIMITATIONS
    No bugs have been reported.

    Please report any bugs or feature requests to
    "bug-www-facebook-api@rt.cpan.org", or through the web interface at
    &lt;http://rt.cpan.org&gt;.

SOURCE REPOSITORY
    http://code.google.com/p/perl-www-facebook-api/

TODO
    Add tests to get better coverage.

    ---------------------------- ------ ------ ------ ------ ------ ------
    ------ File stmt bran cond sub pod time total
    ---------------------------- ------ ------ ------ ------ ------ ------
    ------ blib/lib/WWW/Facebook/API.pm 84.4 69.7 34.3 93.2 100.0 89.5 77.8
    .../WWW/Facebook/API/Auth.pm 81.2 22.2 20.0 80.0 100.0 1.4 69.4
    ...WW/Facebook/API/Canvas.pm 57.1 0.0 16.7 54.5 100.0 0.6 52.8
    ...WW/Facebook/API/Events.pm 92.3 n/a 33.3 75.0 100.0 0.6 85.4
    .../WWW/Facebook/API/FBML.pm 88.9 n/a 33.3 66.7 100.0 0.8 81.8
    ...b/WWW/Facebook/API/FQL.pm 96.0 n/a 33.3 85.7 100.0 0.7 89.5
    .../WWW/Facebook/API/Feed.pm 92.3 n/a 33.3 75.0 100.0 0.9 85.4
    ...W/Facebook/API/Friends.pm 88.9 n/a 33.3 66.7 100.0 0.6 81.8
    ...WW/Facebook/API/Groups.pm 92.3 n/a 33.3 75.0 100.0 0.7 85.4
    ...book/API/Notifications.pm 88.9 n/a 33.3 66.7 100.0 0.9 81.8
    ...WW/Facebook/API/Photos.pm 80.0 n/a 33.3 50.0 100.0 0.6 73.6
    ...W/Facebook/API/Profile.pm 85.7 n/a 33.3 60.0 100.0 1.5 78.7
    ...WW/Facebook/API/Update.pm 96.0 n/a 33.3 85.7 100.0 0.6 89.5
    ...WWW/Facebook/API/Users.pm 88.9 n/a 33.3 66.7 100.0 0.6 81.8 Total
    84.7 61.0 32.5 77.9 100.0 100.0 77.5 ---------------------------- ------
    ------ ------ ------ ------ ------ ------

AUTHOR
    David Romano "&lt;unobe@cpan.org&gt;"

CONTRIBUTORS
    Clayton Scott "http://www.matrix.ca"

    David Leadbeater "http://dgl.cx"

    J. Shirley "&lt;jshirley@gmail.com&gt;"

    Matt Sickler "unknown"

    Nick Gerakines "&lt;nick@socklabs.com&gt;"

    Olaf Alders "&lt;olaf@wundersolutions.com&gt;"

    Patrick Michael Kane "&lt;pmk@wawd.com&gt;"

    Sean O'Rourke "&lt;seano@cpan.org&gt;"

    Shawn Van Ittersum "none"

    Simon Cavalletto "&lt;simonm@cavalletto.org&gt;"

    Thomas Sibley "&lt;tsibley@cpan.org&gt;"

LICENSE AND COPYRIGHT
    Copyright (c) 2007, David Romano "&lt;unobe@cpan.org&gt;". All rights
    reserved.

    This module is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY
    BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
    FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
    OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
    PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
    ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
    YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
    NECESSARY SERVICING, REPAIR, OR CORRECTION.

    IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
    WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
    REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE
    TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
    CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
    SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
    RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
    FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
    SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
    DAMAGES.

</pre></body></html>