WWW-Facebook-API-0.4.18/0000700000175000001440000000000011346642446013764 5ustar dromanousersWWW-Facebook-API-0.4.18/lib/0000700000175000001440000000000011346642445014531 5ustar dromanousersWWW-Facebook-API-0.4.18/lib/WWW/0000700000175000001440000000000011346642445015215 5ustar dromanousersWWW-Facebook-API-0.4.18/lib/WWW/Facebook/0000700000175000001440000000000011346642445016726 5ustar dromanousersWWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/0000700000175000001440000000000011346642445017337 5ustar dromanousersWWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Comments.pm0000644000175000001440000000635211346640055021475 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Comments; use warnings; use strict; use Carp; sub add { return shift->base->call( 'comments.add', @_ ) } sub get { return shift->base->call( 'comments.get', @_ ) } sub remove { return shift->base->call( 'comments.remove', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Comments - Facebook Comments =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing comments with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item add( %params ) The comments.add method of the Facebook API: $response = $client->comments->add( xid => $xid, text => $text, uid => $uid, ); =item get( %params ) The comments.get method of the Facebook API: $response = $client->comments->get( xid => $xid, ); =item remove( %params ) The comments.remove method of the Facebook API: $response = $client->comments->remove( xid => $xid, comment_id => $id ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Comments requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Permissions.pm0000644000175000001440000001275411346640055022226 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Permissions; use warnings; use strict; use Carp; sub begin { my $self = shift; shift; # get rid of hash key $self->base->call_as_api_key(shift); return; } sub end { shift->base->call_as_api_key(q{}); return; } sub grant_api_access { return shift->base->call( 'permissions.grantApiAccess', @_ ); } sub check_available_api_access { return shift->base->call( 'permissions.checkAvailableApiAccess', @_ ); } sub revoke_api_access { return shift->base->call( 'permissions.revokeApiAccess', @_ ); } sub check_granted_api_access { return shift->base->call( 'permissions.checkGrantedApiAccess', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Permissions - Facebook Permissions =head1 SYNOPSIS Implementation of the Facebook Permissions API: use WWW::Facebook::API; # setup, etc # see below for full documentation $client->permissions->grant_api_access( ... ); $client->permissions->check_available_api_access( ... ); $client->permissions->revoke_api_access( ... ); $client->permissions->check_granted_api_access( ... ); =head1 DESCRIPTION Methods for accessing Permissions functions with L =head1 SUBROUTINES/METHODS =over =item begin($call_as_apikey) Mimics C of official PHP API. Successive calls will automatically insert the C key and whatever value is passed in as <$call_as_apikey>. $client->permissions->begin( call_as_apikey => $key, ); =item end Mimics C of official PHP API. Opposite of C. $client->permissions->end( call_as_apikey => $key, ); =item grant_api_access This method gives another application access to certain API calls on behalf of the application calling it. You B supply the API key of the application you want to grant access to. You B also supply an array of methods/namespaces for which access should be granted. $client->permissions->grant_api_access( permissions_apikey => $otherkey, method_arr => '["admin."]' ); L =item check_available_api_access This method returns the API methods to which access has been granted by the specified application. You B supply the API key of the application you want to check. $client->permissions->check_available_api_access( permissions_apikey => $master_key ); L =item revoke_api_access This method revokes the API access granted to the specified application. You B supply the API key of the application for which you want to revoke access. $client->permissions->revoke_api_access( permissions_apikey => $other_key ); L =item check_granted_api_access This method returns the API methods to which the specified application has been given access. You B supply the API key of the application for which you want the check to be made. $client->permissions->check_granted_api_access( permissions_apikey => $other_key ); L =back =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHORS Pedro Figueiredo, C<< >> David Romano C<< >> =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc WWW::Facebook::API::Permissions You can also look for information at: =head1 COPYRIGHT & LICENSE Copyright (c) 2010 Playfish. All Rights reserved. Certain parts copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Status.pm0000644000175000001440000000566511346640055021201 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Status; use warnings; use strict; use Carp; sub get { return shift->base->call( 'status.get', @_ ); } sub set { return shift->base->call( 'status.set', @_ ); } 1; __END__ =head1 NAME WWW::Facebook::API::Status - Facebook Status =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing status with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get( %params ) The status.get method of the Facebook API. The current C is already included. $client->status->get( call_id => $call_id, ); =item set( %params ) The status.set method of the Facebook API. $client->status->set( call_id => $call_id, ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Status requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/FBML.pm0000644000175000001440000001072611346640055020430 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::FBML; use warnings; use strict; use Carp; sub delete_custom_tags { return shift->base->call( 'fbml.deleteCustomTags', @_ ) } sub get_custom_tags { return shift->base->call( 'fbml.getCustomTags', @_ ) } sub register_custom_tags { return shift->base->call( 'fbml.registerCustomTags', @_ ) } sub refresh_img_src { return shift->base->call( 'fbml.refreshImgSrc', @_ ) } sub refresh_ref_url { return shift->base->call( 'fbml.refreshRefUrl', @_ ) } sub set_ref_handle { return shift->base->call( 'fbml.setRefHandle', @_ ) } sub upload_native_strings { return shift->base->call( 'fbml.uploadNativeStrings', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::FBML - Facebook Markup Language =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for updating FBML references with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item delete_custom_tags( names => [@tag_names] ) The fbml.deleteCustomTags method of the Facebook API. =item get_custom_tags( app_id => $id ) The fbml.getCustomTags method of the Facebook API. =item register_custom_tags( tags => [@json_tags] ) The fbml.registerCustomTags method of the Facebook API. =item set_ref_handle( handle => 'handleName', fbml => 'fbml' ) The fbml.setRefHandle method of the Facebook API. See this page on the wiki: http://wiki.developers.facebook.com/index.php/Changing_profile_content =item refresh_img_src( url => $url ) Request an image in Facebook's cache (at the given URL) be refreshed. See this page on the wiki: http://wiki.developers.facebook.com/index.php/Changing_profile_content =item refresh_ref_url( url => $url ) Have Facebook call the given URL to generate the FBML. See this page on the wiki: http://wiki.developers.facebook.com/index.php/Changing_profile_content =item upload_native_strings ( %params ) The fbml.uploadNativeStrings method of the Facebook API. C is the only parameter required. $client->fbml->upload_native_strings( native_strings => 'JSON' ); The format for C is described on the developers wiki: http://wiki.developers.facebook.com/index.php/Fbml.uploadNativeStrings =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::FBML requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR TSIBLEY C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007, TSIBLEY C<< >>. All rights reserved. Certain part copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/LiveMessage.pm0000644000175000001440000000556311346640055022117 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::LiveMessage; use warnings; use strict; use Carp; sub send { return shift->base->call( 'liveMessage.send', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::LiveMessage - Facebook LiveMessage =head1 SYNOPSIS use WWW::Facebook::API::LiveMessage; =head1 DESCRIPTION Methods for accessing live messaging with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item send( %params ) The liveMessage.send method of the Facebook API: $response = $client->livemessage->send( recipient => $uid, event_name => $event_name, message => $message, ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::LiveMessage requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Admin.pm0000644000175000001440000001212011346640055020726 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Admin; use warnings; use strict; use Carp; sub get_allocation { return shift->base->call( 'admin.getAllocation', @_ ); } sub get_app_properties { return shift->base->call( 'admin.getAppProperties', @_ ); } sub get_metrics { return shift->base->call( 'admin.getMetrics', @_ ); } sub get_restriction_info { return shift->base->call( 'admin.getRestrictionInfo', @_ ); } sub set_app_properties { return shift->base->call( 'admin.setAppProperties', @_ ); } sub set_restriction_info { return shift->base->call( 'admin.setRestrictionInfo', @_ ); } sub ban_users { return shift->base->call( 'admin.banUsers', @_ ); } sub unban_users { return shift->base->call( 'admin.unbanUsers', @_ ); } sub get_banned_users { return shift->base->call( 'admin.getBannedUsers', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Admin - Facebook Admin =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing Admin functions with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_allocation( %params ) The Admin.getAllocation method of the Facebook API. $allocation = $client->Admin->get_allocation( integration_point_name => 'notifications_per_day', ); =item get_metrics( %params ) The Admin.getMetrics method of the Facebook API. $result = $client->Admin->get_metrics( start_time => 1222285298, end_time => 1222300000, period => 86400, metrics => '["active_users", "canvas_page_views"]' ); =item get_app_properties( %params ) The Admin.getAppProperties method of the Facebook API. $properties = $client->Admin->get_app_properties( properties => '["application_name","callback_url"]' ); =item set_app_properties( %params ) The Admin.setAppProperties method of the Facebook API. $result = $client->Admin->set_app_properties( properties => encode_json { application_name => 'testapp', callback_url => 'http://example.com/testapp/' } ); =item get_restriction_info( %params ) The Admin.getRestrictionInfo method of the Facebook API. $result = $client->Admin->get_restriction_info(); =item set_restriction_info( %params ) The Admin.setRestrictionInfo method of the Facebook API. $result = $client->Admin->set_restriction_info( encode_json { age => '21+', location => 'us' } ); =item ban_users( %params ) The Admin.banUsers method of the Facebook API. $result = $client->Admin->ban_users( uids => [@uids] ); ==item unban_users( %params ) The Admin.unbanUsers method of the Facebook API. $result = $client->Admin->unban_users( uids => [@uids] ); =item get_banned_users( %params ) The Admin.getBannedUsers method of the Facebook API. $result = $client->Admin->getBannedUsers(); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Admin requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHORS David Romano C<< >> Thomas Burke C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2008-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Users.pm0000644000175000001440000001004511346640055021003 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Users; use warnings; use strict; use Carp; sub get_info { return shift->base->call( 'users.getInfo', @_ ); } sub get_logged_in_user { return shift->base->call( 'users.getLoggedInUser', @_ ); } sub has_app_permission { return shift->base->call( 'users.hasAppPermission', @_ ); } sub is_app_user { return shift->base->call( 'users.isAppUser', @_ ); } sub set_status { return shift->base->call( 'users.setStatus', @_ ); } sub is_verified { return shift->base->call( 'users.isVerified', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Users - Facebook Users =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing users with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_info( uids => $uids, fields => $fields ) The users.getInfo method of the Facebook API: $response = $client->users->get_info( uids => [ 2343, 3435 ], fields => 'about_me' ); $response = $client->users->get_info( uids => 2343, fields => [ qw/about_me quotes/ ] ); =item get_logged_in_user The users.getLoggedInUser method of the Facebook API: $uid = $client->users->get_logged_in_user; =item has_app_permission The users.hasAppPermission method of the Facebook API: $response = $client->users->has_app_permission( ext_perm => 'status_update|photo_upload' ); =item is_app_user The users.isAppUser method of the Facebook API: $app_added = $client->users->is_app_user; =item set_status The users.setStatus method of the Facebook API: $response = $client->users->set_status( status => 'status message', clear => 1|0, ); =item is_verified The users.isVerified method of the Facebook API: $verified = $client->users->is_verified; =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Users requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Events.pm0000644000175000001440000001020111346640055021140 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Events; use warnings; use strict; use Carp; sub cancel { return shift->base->call( 'events.cancel', @_ ) } sub create { return shift->base->call( 'events.create', @_ ) } sub edit { return shift->base->call( 'events.edit', @_ ) } sub rsvp { return shift->base->call( 'events.rsvp', @_ ) } sub get { return shift->base->call( 'events.get', @_ ) } sub get_members { return shift->base->call( 'events.getMembers', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Events - Facebook Events =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing events with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item cancel( %params ) The events.cancel method of the Facebook API: $response = $client->events->cancel( eid => $eid, cancel_message => $message, ); =item create( %params ) The events.create method of the Facebook API: $response = $client->events->create( event_info => $json, data => $RAW_DATA, ); =item edit( %params ) The events.edit method of the Facebook API: $response = $client->events->edit( eid => $eid, event_info => $json, data => $RAW_DATA, ); =item rsvp( %params ) The events.rsvp method of the Facebook API: $response = $client->events->rsvp( eid => $eid, rsvp_status => 'attending|unsure|declined|not_replied', ); =item get( %params ) The events.get method of the Facebook API: $response = $client->events->get( uid => 'uid', eids => [@eids], start_time => 'utc', end_time => 'utc', rsvp_status => 'attending|unsure|declined|not_replied', ); =item get_members( eid => $event_id ) The events.getMembers method of the Facebook API: $response = $client->events->get_members( eid => 233 ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Events requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Friends.pm0000644000175000001440000000761011346640055021300 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Friends; use warnings; use strict; use Carp; sub get { return shift->base->call( 'friends.get', @_ ) } sub get_app_users { return shift->base->call( 'friends.getAppUsers', @_ ) } sub are_friends { return shift->base->call( 'friends.areFriends', @_ ) } sub get_lists { return shift->base->call( 'friends.getLists', @_ ) } sub get_mutual_friends { return shift->base->call( 'friends.getMutualFriends', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Friends - Facebook Friends =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing friends with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get(flid => 'id') The friends.get method of the Facebook API: $response = $client->friends->get(); $response = $client->friends->get(flid => '23432'); =item get_app_users() The friends.getAppUsers method of the Facebook API: $response = $client->friends->get_app_users; =item are_friends( uids1 => [ ... ], uids2 => [ ... ] ) The friends.areFriends method of the Facebook API. The two arguments are array refs that make up an associative array: $response = $client->friends->are_friends( uids1 => [1,7,8], uids2 => [2,3,4] ); See the Facebook API Documentation for more information. =item get_lists() The friends.getLists method of the Facebook API: $response = $client->friends->get_lists; =item get_mutual_friends( %params ) The friends.getMutualFriends method of the Facebook API: $response = $client->friends->get_mutual_friends( target_uid => $target_uid, source_uid => $source_uid, ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Friends requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Message.pm0000644000175000001440000000557311346640055021300 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Message; use warnings; use strict; use Carp; sub get_threads_in_folder { return shift->base->call( 'message.getThreadsInFolder', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Message - Facebook Message =head1 SYNOPSIS use WWW::Facebook::API::Message; =head1 DESCRIPTION Methods for accessing message with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_threads_in_folder( %params ) The message.getThreadsInFolder method of the Facebook API: $response = $client->message->get_threads_in_folder( folder_id => '0|1|4', limit => $limit, ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Message requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Intl.pm0000644000175000001440000000541011346640055020610 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Intl; use warnings; use strict; use Carp; sub get_translations { return shift->base->call( 'intl.getTranslations', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Intl - Facebook Intl =head1 SYNOPSIS use WWW::Facebook::API::Intl; =head1 DESCRIPTION Methods for accessing intl with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_translations( %params ) The intl.get_translations method of the Facebook API: $response = $client->intl->get_translations; =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Intl requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Photos.pm0000644000175000001440000001073111346640055021160 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Photos; use warnings; use strict; use Carp; sub add_tag { return shift->base->call( 'photos.addTag', @_ ) } sub create_album { return shift->base->call( 'photos.createAlbum', @_ ) } sub get { return shift->base->call( 'photos.get', @_ ) } sub get_albums { return shift->base->call( 'photos.getAlbums', @_ ) } sub get_tags { return shift->base->call( 'photos.getTags', @_ ) } sub upload { return shift->base->call( 'photos.upload', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Photos - Facebook Photos =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing photos with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item add_tag( %params ) The photos.addTag method of the Facebook API: $response = $client->photos->add_tag( pid => 2, tag_uid => 3, tag_text => "me", x => 5, y => 6, ); or $response = $client->photos->add_tag( tags => $json_serialized ); C is ignored if C is set. =item create_album( name => $name, location => $loc, description => $descr ) The photos.createAlbum method of the Facebook API: $response = $client->photos->create_album( name => 'fun in the sun', location => 'California', description => "Summer '07", ); =item get( subj_id => 'uid', aid => $album_id, pids => [ @photo_ids ] ) The photos.get method of the Facebook API: $response = $client->photos->get( subj_id => 3, aid => 2, pids => [4,7,8] ); =item get_albums( uid => $uid, aids => [ @album_ids ] ) The photos.getAlbums method of the Facebook API: $response = $client->photos->get_albums( uid => 1, aids => [3,5] ); =item get_tags( pids => [ @photo_ids ] ) The photos.getTags method of the Facebook API: $response = $client->photos->get_tags( pids => [4,5] ); =item upload( aid => $album_id, caption => $caption, data => $data ) The photos.upload method of the Facebook API: $response = $client->photos->upload( aid => 5, caption => 'beach', data => 'raw data', filename => 'filename', # not in official API, but might be useful ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Photos requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/FQL.pm0000644000175000001440000000653611346640055020336 0ustar dromanousers######################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::FQL; use warnings; use strict; use Carp; # always return an array reference. The value returned by Facebook is a hash # reference when there are no results, so this shouldn't be a problem. sub query { return shift->base->call( 'fql.query', @_ ); } sub multiquery { return shift->base->call( 'fql.multiquery', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::FQL - Facebook Query Language =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing messages with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item query( query => 'FQL QUERY LANGUAGE' ) The fql.query method of the Facebook API: $response = $client->fql->query( query => 'FQL query' ); Returns nothing if no result returned from Facebook. =item multiquery( %params ) The fql.multiquery method of the Facebook API: $response = $client->fql->multiquery( queries => [ 'FQL QUERY LANGUAGE #1', 'FQL QUERY LANGUAGE #2', ...] ); Returns nothing if no result returned from Facebook. =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::FQL requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Feed.pm0000644000175000001440000001317511346640055020554 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Feed; use warnings; use strict; use Carp; sub publish_user_action { return shift->base->call( 'feed.publishUserAction', @_ ); } sub register_template_bundle { return shift->base->call( 'feed.registerTemplateBundle', @_ ); } sub deactivate_template_bundle { return shift->base->call( 'feed.deactivateTemplateBundleById', @_ ); } sub get_registered_template_bundle { my $method = @_ > 1 ? 'feed.getRegisteredTemplateBundleById' : 'feed.getRegisteredTemplateBundles'; return shift->base->call( $method, @_ ); } sub publish_templatized_action { return shift->base->call( 'feed.publishTemplatizedAction', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Feed - Facebook Feeds =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing feeds with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item publish_user_action( %params ) The feed.publishUserAction method of the Facebook API. C and C are the only parameters required. $client->feed->publish_user_action( template_bundle_id => 'id', template_data => 'JSON', body_general => 'markup', target_ids => [@array_of_ids], ); The format for C is described on the developer wiki: http://wiki.developers.facebook.com/index.php/Feed.publishUserAction =item register_template_bundle( %params ) The feed.registerTemplateBundle method of the Facebook API. C is the only parameter required. $client->feed->register_template_bundle( one_line_story_templates => 'JSON', short_story_templates => 'JSON', full_story_template => 'JSON', ); The formats for C,C,C are described on the developer wiki: http://wiki.developers.facebook.com/index.php/Feed.registerTemplateBundle =item deactivate_template_bundle( %params ) The feed.deactivateTemplateBundleById method of the Facebook API. C is the only parameter required. $client->feed->deactivate_template_bundle( template_bundle_id => 'template_bundle_id' ); =item get_registered_template_bundle The combined feed.getRegisteredTemplateBundleByID and feed.getRegisteredTemplateBundles methods of the Facebook API. If the C parameter is present only that template bundle will be fetched. $client->feed->get_registered_template_bundle( template_bundle_id => 'template_bundle_id' ); =item publish_templatized_action( %params ) The feed.publishTemplatizedAction method of the Facebook API. C and C are required parameters. $client->feed->publish_templatized_action( page_actor_id => 'page_id', title_template => 'markup', title_data => 'JSON', body_template => 'markup', body_general => 'markup', body_data => 'JSON', image_1 => 'image url', image_1_link => 'destination url', image_2 => 'image url', image_2_link => 'destination url', image_3 => 'image url', image_3_link => 'destination url', image_4 => 'image url', image_4_link => 'destination url', target_ids => [@array_of_ids], ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Feed requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Connect.pm0000644000175000001440000000667211346640055021306 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Connect; use warnings; use strict; use Carp; sub get_unconnected_friends_count { return shift->base->call( 'connect.getUnconnectedFriendsCount', @_ ) } sub register_users { return shift->base->call( 'connect.registerUsers', @_ ) } sub unregister_users { return shift->base->call( 'connect.unregisterUsers', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Connect - Facebook Connect =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing connect with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item add( %params ) The connect.getUnconnectedFriendsCount method of the Facebook API: $response = $client->connect->get_unconnected_friends_count( format => $json, ); =item register_users( %params ) The connect.registerUsers method of the Facebook API: $response = $client->connect->register_users( accounts => [ { email_hash => $email_hash } ] ); =item unregister_users( %params ) The connect.unregisterUsers method of the Facebook API: $response = $client->connect->unregister_users( email_hashes => [@email_hashes] ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Connect requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Links.pm0000644000175000001440000000570511346640055020771 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Links; use warnings; use strict; use Carp; sub get { return shift->base->call( 'links.get', @_ ) } sub post { return shift->base->call( 'links.post', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Links - Facebook Links =head1 SYNOPSIS use WWW::Facebook::API::Links; =head1 DESCRIPTION Methods for accessing links with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get( %params ) The links.get method of the Facebook API: $response = $client->links->get; =item post( %params ) The links.post method of the Facebook API: $response = $client->links->post( uid => $uid, url => $url, comment => $comment, ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Links requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/SMS.pm0000644000175000001440000000613011346640055020344 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::SMS; use warnings; use strict; use Carp; sub can_send { return shift->base->call( 'sms.canSend', @_ ); } sub send { ## no critic return shift->base->call( 'sms.send', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::SMS - Facebook SMS =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing sms with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item can_send( %params ) The sms.canSend method of the Facebook API. $client->sms->can_send( uid => bigint uid, ); =item send( %params ) The sms.send method of the Facebook API. $client->sms->send( uid => bigint uid, message => 'message', session_id => i32, req_session => bool, ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::SMS requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHORS Thomas Burke C<< >> David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2008-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Video.pm0000644000175000001440000000701111346640055020747 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Video; use warnings; use strict; use Carp; sub get_upload_limits { return shift->base->call( 'video.getUploadLimits', @_ ) } sub upload { my $base = shift->base; $base->server_uri('http://api-video.facebook.com/restserver.php'); my $response = $base->call( 'video.upload', format => $base->format, @_ ); $base->server_uri('http://api.facebook.com/restserver.php'); return $response; } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Video - Facebook Video =head1 SYNOPSIS use WWW::Facebook::API::Video; =head1 DESCRIPTION Methods for accessing video with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_upload_limits( %params ) The video.getUploadLimits method of the Facebook API: $response = $client->video->get_upload_limits; =item upload( %params ) The video.upload method of the Facebook API: $response = $client->video->upload( title => $title, description => $description, data => $RAW_DATA, filename => $filename, # not in the official API, but might be useful ); I.> =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Video requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Pages.pm0000644000175000001440000000706111346640055020745 0ustar dromanousers######################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Pages; use warnings; use strict; use Carp; sub get_info { return shift->base->call( 'pages.getInfo', @_ ) } sub is_app_added { return shift->base->call( 'pages.isAppAdded', @_ ) } sub is_admin { return shift->base->call( 'pages.isAdmin', @_ ) } sub is_fan { return shift->base->call( 'pages.isFan', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Pages - Facebook Pages Info =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing messages with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_info( %params ) The pages.getInfo method of the Facebook API: $response = $client->pages->get_info( page_ids => [@pages], fields => [@fields], uid => 'user', type => 'page type', ); =item is_app_added( page_id => 'page' ) The pages.isAppAdded method of the Facebook API: $page_added_app = $client->pages->is_app_added( page_id => 'page' ); =item is_admin( page_id => 'page' ) The pages.isAdmin method of the Facebook API: $is_admin = $client->pages->is_admin( page_id => 'page' ); =item is_fan( page_id => 'page', uid => 'user' ) The pages.isFan method of the Facebook API: $is_fan = $client->pages->is_fan( page_id => 'page', uid => 'uid' ) =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Pages requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Profile.pm0000644000175000001440000001051111346640055021300 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Profile; use warnings; use strict; use Carp; sub set_fbml { return shift->base->call( 'profile.setFBML', @_ ) } sub get_fbml { return shift->base->call( 'profile.getFBML', @_ ) } sub get_info { return shift->base->call( 'profile.getInfo', @_ ) } sub get_info_options { return shift->base->call( 'profile.getInfoOptions', @_ ); } sub set_info { return shift->base->call( 'profile.setInfo', @_ ) } sub set_info_options { return shift->base->call( 'profile.setInfoOptions', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Profile - Facebook Profile =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing profiles with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_fbml( uid => $single_uid ) The profile.getFBML method of the Facebook API. =item set_fbml( profile => $fbml_markup, uid => $single_uid, ... ) The profile.setFBML method of the Facebook API. =item get_info( %params ) The profile.getInfo method of the Facebook API. C is the only required parameter. $client->profile->get_info( uid => 'user_id' ); =item get_info_options( %params ) The profile.getInfoOptions method of the Facebook API. C is the only required parameter. $client->profile->get_info_options( field => 'field_title' ); =item set_info( %params ) The profile.setInfo method of the Facebook API. All parameters are required. $client->profile->set_info( title => 'title', type => '1|5', info_fields => 'JSON', uid => 'user_id', ); The format for C is described on the developer wiki: http://wiki.developers.facebook.com/index.php/Profile.setInfo =item set_info_options( %params ) The profile.setInfoOptions method of the Facebook API. C and C parameters are required. $client->profile->set_info_options( field => 'field_title', options => 'JSON', ); The format for C is described on the developer wiki: http://wiki.developers.facebook.com/index.php/Profile.setInfoOptions =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Profile requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Application.pm0000644000175000001440000000610111346640055022143 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Application; use warnings; use strict; use Carp; sub get_public_info { return shift->base->call( 'Application.getPublicInfo', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Application - Facebook Application =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing application info with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_public_info( %params ) The Application.getPublicInfo method of the Facebook API. $info = $client->application->get_public_info( application_id => 1234 ); $info = $client->application->get_public_info( application_api_key => 1234 ); $info = $client->application->get_public_info( application_canvas_name => 'app_path' ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Application requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHORS David Romano C<< >> Thomas Burke C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Groups.pm0000644000175000001440000000600511346640055021162 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Groups; use warnings; use strict; use Carp; sub get { return shift->base->call( 'groups.get', @_ ) } sub get_members { return shift->base->call( 'groups.getMembers', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Groups - Facebook Groups =head1 SYNOPSIS use WWW::Facebook::API::Groups; =head1 DESCRIPTION Methods for accessing groups with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get( uid => 'uid', gids => [ @gids ] ) The groups.get method of the Facebook API: $response = $client->groups->get( uid => 234324, gids => [2423,334] ); =item get_members( gid => $gid ) The groups.get_members method of the Facebook API: $response = $client->groups->get_members( gid => 32 ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Groups requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Notifications.pm0000644000175000001440000000766511346640055022531 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Notifications; use warnings; use strict; use Carp; sub get { return shift->base->call( 'notifications.get', @_ ) } sub send { return shift->base->call( 'notifications.send', @_ ) } ## no critic sub send_email { return shift->base->call( 'notifications.sendEmail', @_ ); } sub get_list { return shift->base->call( 'notifications.getList', @_ ); } sub mark_read { return shift->base->call( 'notifications.markRead', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Notifications - Facebook Notifications =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing notification information with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get() The notifications.get method of the Facebook API: $response = $client->notifications->get; =item send( to_ids => [ @uids ], notification => $fbml_markup ) The notifications.send method of the Facebook API: $response = $client->notifications->send( to_ids => [1], notification => 'notifications page FBML', ); =item send_email( %params ) The notifications.sendEmail method of the Facebook API: $response = $client->notifications->send_email( recipients => [1, 2343, 445], subject => 'subject', text => 'text version of email body', fbml => 'fbml version of email body', ); =item get_list( %params ) The notifications.getList method of the Facebook API: $response = $client->notifications->get_list(); =item mark_read( %params ) The notifications.markRead method of the Facebook API: $response = $client->notifications->mark_read( notification_ids => [@notification_ids], ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Notifications requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Notes.pm0000644000175000001440000000675311346640055021005 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Notes; use warnings; use strict; use Carp; sub create { return shift->base->call( 'notes.create', @_ ) } sub delete { return shift->base->call( 'notes.delete', @_ ) } sub edit { return shift->base->call( 'notes.edit', @_ ) } sub get { return shift->base->call( 'notes.get', @_ ) } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Notes - Facebook Notes =head1 SYNOPSIS use WWW::Facebook::API::Notes; =head1 DESCRIPTION Methods for accessing notes with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item create( %params ) The notes.create method of the Facebook API: $response = $client->notes->create( uid => $uid, title => $title, content => $content, ); =item delete( %params ) The notes.delete method of the Facebook API: $response = $client->notes->delete( note_id => $id, title => $title, content => $content, ); =item edit( %params ) The notes.edit method of the Facebook API: $response = $client->notes->edit( note_id => $id, title => $title, content => $content, ); =item get( %params ) The notes.get method of the Facebook API: $response = $client->notes->get(); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Notes requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Stream.pm0000644000175000001440000001175311346640055021144 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Stream; use warnings; use strict; use Carp; sub add_comment { return shift->base->call( 'stream.addComment', @_ ); } sub add_like { return shift->base->call( 'stream.addLike', @_ ); } sub get { return shift->base->call( 'stream.get', @_ ); } sub get_comments { return shift->base->call( 'stream.getComments', @_ ); } sub get_filters { return shift->base->call( 'stream.getFilters', @_ ); } sub publish { my $base = shift->base; my %args = @_; if (ref($args{'action_links'}) eq 'ARRAY') { eval q{use JSON::Any}; croak "Unable to load JSON module to encode 'action_links':$@\n" if $@; $args{'action_links'} = $base->_parser->encode( $args{'action_links'} ); } return $base->call( 'stream.publish', %args ); } sub remove { return shift->base->call( 'stream.remove', @_ ); } sub remove_comment { return shift->base->call( 'stream.removeComment', @_ ); } sub remove_like { return shift->base->call( 'stream.removeLike', @_ ); } 1; __END__ =head1 NAME WWW::Facebook::API::Stream - Facebook Stream =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing stream with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item add_comment( %params ) The stream.add_comment method of the Facebook API. $client->stream->add_comment( uid => $uid, ); =item add_like( %params ) The stream.add_like method of the Facebook API. $client->stream->add_like( uid => $uid, post_id => $post_id, ); =item get( %params ) The stream.get method of the Facebook API. $client->stream->get( viewer_id => id, source_ids => [@source_ids], ); =item get_comments( %params ) The stream.get_comments method of the Facebook API. $client->stream->get_comments( post_id => $number, ); =item get_filters( %params ) The stream.getFilters method of the Facebook API. $client->stream->get_filters( uid => $uid, session_key => $key, ); =item publish( %params ) The stream.publish method of the Facebook API. $client->stream->publish( message => $message, attachment => $json, action_links => [@links], ); =item remove( %params ) The stream.remove method of the Facebook API. $client->stream->remove( post_id => $post_id, ); =item remove_comment( %params ) The stream.removeComment method of the Facebook API. $client->stream->remove_comment( comment_id => $comment_id, ); =item remove_like( %params ) The stream.removeLike method of the Facebook API. $client->stream->remove_like( post_id => $post_id, ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Stream requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHORS Herman Polloni C<< >> David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Data.pm0000644000175000001440000000617611346640055020565 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Data; use warnings; use strict; use Carp; sub get_cookies { return shift->base->call( 'data.getCookies', @_ ); } sub set_cookie { return shift->base->call( 'data.setCookie', @_ ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Data - Facebook Data =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing data with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_cookies The data.getCookies method of the Facebook API: $cookies = $client->data->get_cookies( uid => '467542', name => 'foo', # optional ); =item set_cookie The data.setCookie method of the Facebook API: $response = $client->data->set_cookie( uid => '23423', name => 'foo', value => 'bar', expires => 'epochtime', # optional path => '/', # optional ); =back =head1 DIAGNOSTICS None. =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Data requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Auth.pm0000644000175000001440000002231211346640055020603 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Auth; use warnings; use strict; use Carp; use Readonly; Readonly my $DEFAULT_SLEEP => 15; sub create_token { my $self = shift; my $token; my ( $format, $parse ) = ( $self->base->format, $self->base->parse ); $self->base->format('JSON'); $self->base->parse(0); $token = $self->base->call( 'auth.createToken', @_ ); $token =~ s/\W//xmsg; $self->base->format($format); $self->base->parse($parse); return $token; } sub get_session { my $self = shift; my $token = shift; croak q{Token needed for call to get_session} if not defined $token; # Mappings between the response fields and the WFA fields my %field = qw( session_key session_key expires session_expires uid session_uid secret secret ); # Desktop apps need to call the https rather than http endpoint $self->_use_https_uri() if $self->base->desktop; # Save format and parse settings, and get parsed response from server my ( $format, $parse ) = ( $self->base->format, $self->base->parse ); $self->base->format('JSON'); $self->base->parse(1); my $resp = $self->base->call( 'auth.getSession', auth_token => $token ); $self->base->format($format); $self->base->parse($parse); $self->_use_http_uri() if $self->base->desktop; # Copy values from response to object's hash AUTH_RESPONSE: for my $key ( keys %{$resp} ) { next AUTH_RESPONSE if $key eq 'secret' && !$self->base->desktop; carp "Setting $field{$key}: $resp->{$key}" if $self->base->debug; $self->base->{ $field{$key} } = $resp->{$key}; } return; } sub login { my ( $self, %args ) = @_; croak q{Cannot use login method with web app} unless $self->base->desktop; my $token = $self->create_token; my $url = $self->base->get_login_url( auth_token => $token ); my $browser = $args{'browser'} ? $args{'browser'} : $^O =~ m/darwin/xms ? 'open' ## no critic : $^O =~ m/MSWin/xms ? 'start' ## no critic : q{}; croak "Don't know how to open browser for system '$^O'" if not $browser; # Open browser have user login to Facebook app system qq($browser "$url"); # Give the user time to log in $args{'sleep'} ||= $DEFAULT_SLEEP; sleep $args{'sleep'}; return $token; } sub expire_session { my $self = shift; return $self->base->call('auth.expireSession', session_key => $self->base->session_key, @_); } sub promote_session { my $self = shift; return $self->base->call( 'auth.promoteSession', session_key => $self->base->session_key, @_ ); } sub revoke_authorization { return shift->base->call( 'auth.revokeAuthorization', @_ ); } sub revoke_extended_permission { return shift->base->call( 'auth.revokeExtendedPermission', @_ ); } sub logout { my $self = shift; $self->base->ua->post( 'http://www.facebook.com/logout.php', { confirm => 1 } ); return; } sub _use_http_uri { return shift->_flip_scheme(0); } ## no critic sub _use_https_uri { return shift->_flip_scheme(1); } ## no critic sub _flip_scheme { my $self = shift; my $make_https = shift; my $scheme = $make_https ? 'http' : 'https'; ( my $uri = $self->base->server_uri() ) =~ s{^[^:]+:}{$scheme:}xms; $self->base->server_uri($uri); return; } 1; __END__ =head1 NAME WWW::Facebook::API::Auth - Facebook Authentication =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for accessing auth with L =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item create_token() auth.createToken of the Facebook API. Will always return the token string, regardles of the C setting in L: $token = $client->auth->create_token; =item get_session( $token ) auth.getSession of the Facebook API. If you have the desktop attribute set to true and C<$token> isn't passed in, the return value from C<< $client->auth->create_token >> will be used. If the desktop attribute is set to false the C<$token> must be the auth_token returned from Facebook to your web app for that user: if ( $q->param('auth_token') ) { $client->auth->get_session( $q->param('auth_token') ); } C automatically sets C, C, and C for C<$client>. It returns nothing. =item login( sleep => $sleep , browser => $browser_cmd ) Only for desktop apps. It first calls C to get a valid token. It then opens the user's default browser and have them sign in to the Facebook application. If C is passed in, the module will use that string as the command to execute, e.g.: system qq($browser_cmd "$login_url"); After the browser is called, it will pause for C<$sleep> seconds (or 15 seconds if C<$sleep> is not defined), to give the user time to log in. The method returns the session token created by C. =item expire_session( %params) Implementation of the auth.expireSession function. $result = $client->auth->expire_session(); =item promote_session( %params) Implementation of the auth.promoteSession function. $result = $client->auth->promote_session(); =item revoke_authorization( %params) Implementation of the auth.revokeAuthorization function. $result = $client->auth->revoke_authorization(); =item revoke_extended_permission( %params) Implementation of the auth.revokeExtendedPermission function. $result = $client->auth->revoke_extended_permission( perm => 'email', uid => $uid ); =item logout() Sends a POST to http://www.facebook.com/logout.php, with the parameter "confirm" set to 1 (Cf. http://developers.facebook.com/documentation.php?v=1.0&doc=auth ) =back =head1 PRIVATE METHODS =over =item _use_http_uri() Makes the WFA object's server URI scheme http. Uses C<_flip_scheme>. =item _use_https_uri() Makes the WFA object's server URI scheme https. Uses C<_flip_scheme>. =item _flip_scheme( $make_https ) If C<$make_https> is true, the scheme becomes https. If false, the scheme becomes http. The WFA object's C attribute is then set to use that scheme. =back =head1 DIAGNOSTICS =over =item C< Token needed for call to get_session > You are running a desktop app and you did not pass a token into get_session. You can create a token by calling create_token() or (better) login(). You are running a web app and the user hasn't logged in to Facebook for your web app. When the user does so, an auth_token will be returned (as a parameter) to your callback url. Use that auth_token for the session. =item C< Don't know how to open browser for the system %s > The module doesn't know the command to use to open a browser on the given system. If you passed in C to login(), it can use that string as the command to execute to open the login url. =item C< Cannot use login method with web app > The login() method is not able to be used to sign in when using a web app. See the Facebook TOS A.9.iv. =back =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Auth requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHOR David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Exception.pm0000644000175000001440000000665611346640055021655 0ustar dromanousers######################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Exception; use warnings; use strict; use Carp; use overload ('""' => 'stringify'); sub new { my ($class, $method, $params, $response) = @_; my $self = { _method => $method, _params => $params, _response => $response }; $self = bless $self, $class; } sub method { my $self = shift; return $self->{_method} } sub params { my $self = shift; return $self->{_params} } sub response { my $self = shift; return $self->{_response} } sub stringify { my $self = shift; my $method = $self->method; my $params = $self->params; my $response = $self->response; return "Error during REST $method call:" . WWW::Facebook::API->log_string( $params, $response ); } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API::Exception - Facebook API exception =head1 DESCRIPTION Exception thrown by L when an error occurs. =head1 SUBROUTINES/METHODS =over =item new( SCALAR $method, HASHREF $params, HASHREF $response ) Returns a new instance of this class for an error in the REST method call to $method, which was given parameters $params, and returned $response. =item method Returns the method call which generated the error. =item params Returns the parameters passed to the method call which generated the error. =item response Returns the server's resopnse to the method call which generated the error. =item stringify Returns a string describing the error. =back =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHORS Kevin Riggle C<< none >> David Romano C<< >> =head1 LICENSE AND COPYRIGHT Certain part copyright (c) 2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API/Canvas.pm0000644000175000001440000001630711346642266021132 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API::Canvas; use warnings; use strict; use Carp; sub get_fb_params { my $self = shift; $self->base->query(shift); my $fb_params = {}; # verify - FB Connect or Native? my @query = ''; my $api_key_pre = $self->base->api_key."_"; if ($self->base->query->param('fb_sig')) { @query = grep {m/^fb_sig_/xms} $self->base->query->param; } else { @query = grep {m/^$api_key_pre/xms} $self->base->query->cookie; } for my $param (@query) { my @values = ''; if ($self->base->query->param('fb_sig')) { @values = $self->base->query->param($param); } else { @values = $self->base->query->cookie($param)->value; } if ( @values > 1 || ref $values[0] ) { croak "Multiple values for $param: Are you using POST for forms?"; } if ($self->base->query->param('fb_sig')) { my $attribute = ( $param =~ /^fb_sig_ (.*) $/xms )[0]; $fb_params->{$attribute} = $self->base->query->param($param); } else { my $attribute = ( $param =~ /^$api_key_pre (.*) $/xms )[0]; $fb_params->{$attribute} = $self->base->query->cookie($param)->value; } } return $fb_params; } sub get_non_fb_params { my $self = shift; $self->base->query(shift); my $non_fb_params = {}; my @query = grep { !/^fb_sig_?/xms } $self->base->query->param; for my $param (@query) { my @values = $self->base->query->param($param); if ( @values > 1 || ref $values[0] ) { croak "Multiple values for $param. Are you using POST for forms?"; } $non_fb_params->{$param} = $self->base->query->param($param); } return $non_fb_params; } sub validate_sig { my $self = shift; $self->base->query(shift); my $fb_params = $self->get_fb_params; return unless $self->base->query->param('fb_sig') || $self->base->query->cookie($self->base->api_key)->value; return $fb_params if $self->base->verify_sig( params => $fb_params, sig => $self->base->query->param('fb_sig') || $self->base->query->cookie($self->base->api_key)->value, ); return; } sub get_user { my $self = shift; $self->base->query(shift); my $fb_params = $self->validate_sig; return $fb_params->{'user'} if exists $fb_params->{'user'}; return q{}; } sub in_fb_canvas { my $self = shift; $self->base->query(shift); return $self->get_fb_params->{'in_canvas'}; } sub in_frame { my $self = shift; $self->base->query(shift); my $fb_params = $self->get_fb_params; return 1 if $fb_params->{'in_canvas'} or $fb_params->{'in_iframe'}; return; } 1; __END__ =head1 NAME WWW::Facebook::API::Canvas - Facebook Canvas =head1 SYNOPSIS use WWW::Facebook::API; =head1 DESCRIPTION Methods for using the canvas with L The C<$q> parameter should implement the param and cookie methods (for example a L or L object). =head1 SUBROUTINES/METHODS =over =item base Returns the L base object. =item new Constructor. =item get_user( $q ) Return the UID of the canvas user or "" if it does not exist (See L): $response = $client->canvas->get_user( $q ) If C<$q> is not passed in, the value returned by C<< $client->base->query() >> is used. =item get_fb_params( $q ) Return a hash reference to the signed parameters sent via Facebook (See L): $response = $client->canvas->get_fb_params( $q ) If C<$q> is not passed in, the value returned by C<< $client->base->query() >> is used. =item get_non_fb_params( $q ) Return a hash reference to the parameters that are not part of the signed facebook parameters. This is useful if your app send a POST request to Facebook and you want to use the data you POSTed: $non_fb_params = $client->canvas->get_non_fb_params( $q ) If C<$q> is not passed in, the value returned by C<< $client->base->query() >> is used. =item in_fb_canvas( $q ) Return true if inside a canvas (See L): $response = $client->canvas->in_fb_canvas( $q ) If C<$q> is not passed in, the value returned by C<< $self->base->query() >> is used. =item in_frame( $q ) Return true if inside an iframe or canvas (See L): $response = $client->canvas->in_frame( $q ) If C<$q> is not passed in, the value returned by C<< $self->base->query() >> is used. =item validate_sig( $q ) Return a hash reference containing the fb_sig_* params (with C stripped) if the signature of the $q object is valid for this application (See L): $fb_params = $client->canvas->validate_sig( $q ) # $fb_params doesn't contain a sig key If C<$q> is not passed in, the value returned by C<< $self->base->query() >> is used. =back =head1 DIAGNOSTICS =over =item C<< Multiple values for %s. Are you using POST for forms? >> Your forms are most likely using GET rather than POST to the Facebook URLs. Change your forms to using POST and the problem should be resolved. (See RT#31620 and RT#31944 for more information). =back =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API::Canvas requires no configuration files or environment variables. =head1 DEPENDENCIES See L =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHORS David Leadbeater C<< http://dgl.cx >> David Romano C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007, David Leadbeater C<< http://dgl.cx >>. Certain parts copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/lib/WWW/Facebook/API.pm0000644000175000001440000012646211346642076017722 0ustar dromanousers######################################################################### # ex: set ts=8 sw=4 et ######################################################################### package WWW::Facebook::API; use warnings; use strict; use Carp; use version; our $VERSION = qv('0.4.18'); use LWP::UserAgent; use Time::HiRes qw(time); use Digest::MD5 qw(md5_hex); use Encode qw(encode_utf8 is_utf8); use CGI; use CGI::Util qw(escape); use WWW::Facebook::API::Exception; our @namespaces = qw( Admin Application Auth Canvas Comments Connect Data Events FBML Feed FQL Friends Groups Intl Links LiveMessage Message Notes Notifications Pages Permissions Photos Profile SMS Status Stream Users Video ); for (@namespaces) { my $package = __PACKAGE__ . "::$_"; my $name = "\L$_"; ## no critic my $namespace = eval qq( use $package; sub $name { my \$self = shift; unless ( \$self->{'_$name'} ) { \$self->{'_$name'} = $package->new( base => \$self ); } return \$self->{'_$name'}; } package $package; sub base { return shift->{'base'}; }; sub new { my ( \$class, \%args ) = \@_; my \$self = bless \\\%args, \$class; delete \$self->{\$_} for grep { !/base/xms } keys %{\$self}; \$self->\$_ for keys %{\$self}; return \$self; }; 1; ); croak "Cannot create namespace $name: $@\n" if not $namespace; } our %attributes = ( parse => 1, format => 'JSON', debug => 0, throw_errors => 1, api_version => '1.0', apps_uri => 'http://apps.facebook.com/', server_uri => 'http://api.facebook.com/restserver.php', ( map { $_ => q{} } qw( api_key secret desktop last_call_success last_error skipcookie popup next session_key session_expires session_uid callback app_path ua query config app_id call_as_apikey ) ), ); for ( keys %attributes ) { ## no critic my $attribute = eval qq( sub $_ { my \$self = shift; return \$self->{$_} = shift if defined \$_[0]; return \$self->{$_} if defined \$self->{$_}; return \$self->{$_} = '$attributes{$_}'; } 1; ); croak "Cannot create attribute $_: $@\n" if not $attribute; } sub _set_from_outside { my $self = shift; my $app_path = '_' . ( $self->{'app_path'} || $self->app_path ); $app_path =~ tr/a-z/A-Z/; $app_path =~ tr/A-Za-z0-9_/_/c; my %ENV_VARS = qw( WFA_API_KEY api_key WFA_SECRET secret WFA_DESKTOP desktop WFA_SESSION_KEY session_key ); $self->_set_from_file( $app_path, %ENV_VARS ) if $self->{'config'}; $self->_set_from_env( $app_path, %ENV_VARS ); return; } sub _set_from_file { my $self = shift; my $app_path = shift; my %ENV_VARS = @_; open my $config, '<', $self->{'config'} ## no critic or croak "Cannot open $self->{'config'}"; while (<$config>) { carp "Config line: $_" if $self->{'debug'}; chomp; my ( $key, $val ) = split m/=/xms, $_, 2; next if !$key; carp "Key/Val pair: $key -> $val" if $self->{'debug'}; for ( $key, $val ) { s/\A\s+//xms; s/\s+\Z//xms; } $ENV{$key} ||= $val; } close $config or croak "Cannot close $self->{'config'}"; return; } sub _set_from_env { my $self = shift; my $app_path = shift; my %ENV_VARS = @_; for ( keys %ENV_VARS ) { if ( exists $ENV{ $_ . $app_path } ) { $self->{ $ENV_VARS{$_} } ||= $ENV{ $_ . $app_path }; } elsif ( exists $ENV{$_} ) { $self->{ $ENV_VARS{$_} } ||= $ENV{$_}; } } return; } sub new { my ( $self, %args ) = @_; my $class = ref $self || $self; $self = bless \%args, $class; $self->_set_from_outside(); # set api_key etc. if needed $self->{'ua'} ||= LWP::UserAgent->new( agent => "Perl-WWW-Facebook-API/$VERSION" ); my $is_attribute = join q{|}, keys %attributes; delete $self->{$_} for grep { !/^ $is_attribute $/xms } keys %{$self}; # set up default namespaces $self->$_($self) for map {"\L$_"} @namespaces; # set up default attributes $self->$_ for keys %attributes; return $self; } sub log_string { my ( $self, $params, $response ) = @_; my $string = "\nparams = \n"; $string .= "\t$_:$params->{$_}\n" for sort keys %{$params}; $string .= "response =\n$response\n"; return $string; } sub call_success { my $self = shift; $self->last_call_success(shift) if @_; $self->last_error(shift) if @_; return [ $self->last_call_success, $self->last_error ]; } sub call { my ( $self, $method, %args ) = @_; my ( $response, $params, $sig, $raw_data, $filename ); $self->call_success(1); if ( $self->call_as_apikey ) { $args{'call_as_apikey'} = $self->call_as_apikey; } ( $params, $raw_data, $filename ) = $self->_format_and_check_params( $method, %args ); $sig = $self->generate_sig( params => $params, secret => delete $params->{'secret'}, ); $response = $self->_post_request( $params, $sig, $raw_data, $filename ); carp $self->log_string( $params, $response ) if $self->debug; if ( $self->_has_error_response($response) ) { if ( $self->throw_errors ) { warn WWW::Facebook::API::Exception->new( $method, $params, $response ); } } return $self->_reformat_response( $params, $response ); } sub generate_sig { my ( $self, %args ) = @_; my %params = %{ $args{'params'} }; return md5_hex( ( map {"$_=$params{$_}"} sort keys %params ), $args{'secret'} ); } sub verify_sig { my ( $self, %args ) = @_; return $args{'sig'} eq $self->generate_sig( params => $args{'params'}, secret => $args{'secret'} || $self->secret, ); } sub session { my ( $self, %args ) = @_; $self->{"session_$_"} = $args{$_} for keys %args; return; } sub redirect { my $self = shift; my $url = shift; $self->query(shift); if ( $self->canvas->in_fb_canvas ) { return qq{}; } elsif ($url =~ m{^https?://([^/]*\.)?facebook\.com(:\d+)?}ixms && $self->session_uid ) { return join q{}, map {"$_\n"} ''; } print CGI->new->redirect( $self->get_app_url( next => $self->get_login_url ) ); return 1; } sub require_add { return shift->require( 'add', @_ ); } sub require_frame { return shift->require( 'frame', @_ ); } sub require_login { return shift->require( 'login', @_ ); } sub require { ## no critic my $self = shift; my $what = shift; $self->query(shift); if ( $what eq 'login' ) { unshift @_, qw( canvas ) if $self->canvas->in_frame; } if ( $what eq 'frame' ) { return if $self->canvas->in_frame; unshift @_, qw( canvas ); $what = 'login'; } my $user = $self->canvas->get_fb_params->{'user'}; if ( $what eq 'add' ) { if ( !$self->canvas->get_fb_params->{'added'} ) { $user = undef; } } return if $user; return $self->redirect( $self->get_url( $what, @_ ) ); } sub get_facebook_url { return shift->get_url( 'facebook', @_ ); } sub get_add_url { return shift->get_url( 'add', @_ ); } sub get_infinite_session_url { return shift->get_url('infinite_session'); } sub get_login_url { return shift->get_url( 'login', @_ ); } sub get_app_url { return shift->get_url( 'app', @_ ); } sub get_url { my $self = shift; my $type = shift; if ( $type eq 'facebook' ) { my $site = shift || 'www'; return "http://$site.facebook.com"; } if ( $type eq 'app' ) { return $self->apps_uri . $self->app_path . q{/}; } if ( $type eq 'custom' ) { return (shift) . $self->_add_url_params(@_); } return $self->get_url('facebook') . ( $type eq 'add' ? '/add.php' : $type eq 'infinite_session' ? '/code_gen.php' : $type eq 'login' ? '/login.php' : q{} ) . $self->_add_url_params(@_); } sub unescape_string { my $self = shift; my $string = shift; $string =~ s/(?api_key . q{&v=1.0}; if (@_) { if ( @_ % 2 ) { # Odd number of elelemts, so didn't pass in canvas => 1 $params .= q{&canvas} if grep { $_ eq 'canvas' } @_; ## no critic @_ = grep { $_ ne 'canvas' } @_; } my %params = @_; $params .= q{&canvas} if delete $params{'canvas'}; for ( sort keys %params ) { next if not defined $params{$_}; $params{$_} = escape( $params{$_} ) if $_ eq 'next'; $params .= "&$_=$params{$_}"; } } return $params; } sub _parser { my $parser = JSON::Any->new; $parser->handler->allow_nonref; return $parser; } sub _parse { my ( $self, $response ) = @_; # Some shortcuts return q{} if $response =~ /\A"?"?\Z/xms; return 1 if $response =~ /\A"?true"?\Z/xms; return 0 if $response =~ /\A"?false"?\Z/xms; my $parser; eval { $parser = _parser(); 1; } or do { # Only load JSON::Any if we haven't already. Lets the developers # pick their choice of JSON modules (JSON::DWIW, for example) ## no critic eval q{use JSON::Any}; croak "Unable to load JSON module for parsing:$@\n" if $@; $parser = _parser(); }; carp 'JSON::Any is parsing with ' . $parser->handlerType if $self->debug; return $parser->decode($response); } sub _check_values_of { my ( $self, $params ) = @_; if ( $self->desktop ) { $params->{'call_id'} = time if $self->desktop; } if ( $params->{'method'} !~ m/^auth/xms ) { $params->{'session_key'} ||= $self->session_key; if ( !$params->{'callback'} && $self->callback ) { $params->{'callback'} = $self->callback; } } $params->{'method'} = "facebook.$params->{'method'}"; $params->{'v'} ||= $self->api_version; $params->{$_} ||= $self->$_ for qw(api_key format); return; } sub _format_and_check_params { my ( $self, $method, %args ) = @_; my $params = delete $args{'params'} || {}; $params->{$_} = $args{$_} for keys %args; $params->{'secret'} ||= $self->secret; $params->{'method'} ||= $method; $self->_check_values_of($params); # reformat arrays and add each param to digest for ( keys %{$params} ) { if ( ref $params->{$_} eq 'ARRAY' ) { $params->{$_} = join q{,}, @{ $params->{$_} }; } if ( is_utf8( $params->{$_} ) ) { $params->{$_} = encode_utf8( $params->{$_} ); } } croak '_format_and_check_params must be called in list context!' if !wantarray; return ( $params, delete $params->{'data'}, delete $params->{'filename'} ); } sub _has_error_response { my $self = shift; my $response = shift; # The different type of error responses my $json = q{ \{ "error_code" \D+ (\d+) .* "error_msg" [^"]+ "([^"]+)" }; my $xml = q{ (\d+) .* ([^<]+)}; for ( $json, $xml ) { if ( $response =~ m/$_/xms ) { $self->call_success( 0, "$1: $2" ); return 1; } } return; } sub _reformat_response { my ( $self, $params, $response ) = @_; # get actual response when web app if ( $params->{'callback'} ) { $response =~ s/^$params->{'callback'} [^(]* [(](.+) [)];$/$1/xms; } undef $params; # ... and unescape it if it's not going to be parsed if ( !$self->desktop && !$self->parse ) { $response = $self->unescape_string($response); } if ( $self->parse && $self->format eq 'XML' ) { $self->parse(0); carp q{format is XML: setting parse to 0} if $self->debug; } return $response if !$self->parse; $response = $self->_parse($response); return if $self->_is_empty_response($response); return $response; } sub _is_empty_response { my ( $self, $response ) = @_; return 1 if ref $response eq 'HASH' && !keys %{$response}; return 1 if ref $response eq 'ARRAY' && @{$response} == 0; return; } sub _post_request { my ( $self, $params, $sig, $raw_data, $filename ) = @_; my $post_params = [ map { $_ => $params->{$_} } sort keys %{$params} ]; push @{$post_params}, 'sig' => $sig; if ($raw_data) { push @{$post_params}, data => [ undef, ( $filename || 'filename'), 'Content-Type' => 'application/octet-stream', 'Content' => $raw_data, ]; } return $self->ua->post( $self->server_uri, 'Content_type' => 'form-data', 'Content' => $post_params, )->content; } 1; # Magic true value required at end of module __END__ =head1 NAME WWW::Facebook::API - Facebook API implementation =head1 VERSION This document and others distributed with this module describe WWW::Facebook::API version 0.4.18 =head1 SYNOPSIS use WWW::Facebook::API; # @ENV{qw/WFA_API_KEY WFA_SECRET WFA_DESKTOP/} are the initial values, # so use those if you only have one app and don't want to pass in values # to constructor my $client = WWW::Facebook::API->new( desktop => 0, api_key => 'your api key', secret => 'your secret key', ); # Change API key and secret print "Enter your public API key: "; chomp( my $val = ); $client->api_key($val); print "Enter your API secret: "; chomp($val = ); $client->secret($val); # not needed if web app (see $client->canvas->get_fb_params) $client->auth->get_session( $token ); use Data::Dumper; my $friends_perl = $client->friends->get; print Dumper $friends_perl; my $notifications_perl = $client->notifications->get; print Dumper $notifications_perl; # Current user's quotes my $quotes_perl = $client->users->get_info( uids => $friends_perl, fields => ['quotes'] ); print Dumper $quotes_perl; $client->auth->logout; =head1 DESCRIPTION A Perl implementation of the Facebook API, working off of the canonical Java and PHP implementations. By default it uses L 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 C method below). As the synopsis states, the following environment variables are used to set the defaults for new instances: WFA_API_KEY WFA_SECRET WFA_SESSION_KEY WFA_DESKTOP Additionally, for each instance that is created, the following environment variables are used if no values are set: WFA_API_KEY_APP_PATH WFA_SECRET_APP_PATH WFA_SESSION_KEY_APP_PATH WFA_DESKTOP_APP_PATH Where C is replaced by whatever $client->app_path returns, with all non-alphanumeric characters replaced with an underscore and all characters upcased (e.g., foo-bar-baz becomes FOO_BAR_BAZ). =head1 SUBROUTINES/METHODS =over =item new( %params ) Returns a new instance of this class. You are able to pass in any of the attribute method names in L to set its value: my $client = WWW::Facebook::API->new( parse => 1, format => 'JSON', secret => 'application_secret_key', api_key => 'application_key', session_key => 'session_key', session_expires => 'session_expires', session_uid => 'session_uid', desktop => 1, api_version => '1.0', callback => 'callback_url', next => 'next', popup => 'popup', skipcookie => 'skip_cookie', throw_errors => 1, ); $copy = $client->new; =back =head1 NAMESPACE METHODS All method names from the Facebook API are lower_cased instead of CamelCase. =over =item admin admin namespace of the API (See L). =item application application namespace of the API (See L). =item auth For desktop apps, these are synonymous: $client->auth->get_session( $client->auth->create_token ); $client->auth->get_session; And that's all you really have to do (but see L for details about opening a browser on *nix for Desktop apps). C automatically sets C, C, and C for C<$client>. It returns nothing. If the desktop attribute is set to false the C<$token> must be the auth_token returned from Facebook to your web app for that user: if ( $q->param('auth_token') ) { $client->auth->get_session( $q->param('auth_token') ); } C automatically sets C, C, and C for C<$client>. It returns nothing. See L for details. =item canvas Work with the canvas. See L. $response = $client->canvas->get_user( $q ) $response = $client->canvas->get_fb_params( $q ) $response = $client->canvas->get_non_fb_params( $q ) $response = $client->canvas->validate_sig( $q ) $response = $client->canvas->in_fb_canvas( $q ) $response = $client->canvas->in_frame( $q ) =item comments comments namespace of the API (See L). =item connect connect namespace of the API (See L). =item data data namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->data->set_cookie( uid => 23, qw/name foo value bar/); $cookies = $client->data->get_cookies( uid => 4534, name => 'foo', ); =item events events namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->events->get( uid => 'uid', eids => [@eids], start_time => 'utc', end_time => 'utc', rsvp_status => 'attending|unsure|declined|not_replied', ); $response = $client->events->get_members( eid => 233 ); =item fbml fbml namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->fbml->set_ref_handle( handle => '', fbml => ''); $response = $client->fbml->refresh_img_src( url => ''); $response = $client->fbml->refresh_ref_url( url => ''); =item feed feed namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->feed->publish_story_to_user( title => 'title', body => 'markup', ... ); $response = $client->feed->publish_action_of_user( title => 'title', body => 'markup', ... ); $response = $client->feed->publish_templatized_action( actor_id => 'title', title_template => 'markup', ... ); =item fql fql namespace of the API (See L): $response = $client->fql->query( query => 'FQL query' ); =item friends friends namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->friends->get; $response = $client->friends->get_app_users; $response = $client->friends->are_friends( uids1 => [1,5,8], uids2 => [2,3,4] ); $response = $client->friends->get_lists; =item groups groups namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->groups->get( uid => 234324, gids => [2423,334] ); $response = $client->groups->get_members( gid => 32 ); =item intl intl namespace of the API (See L). =item links links namespace of the API (See L). =item livemesssage liveMesssage namespace of the API (See L). =item message message namespace of the API (See L). =item notes notes namespace of the API (See L). =item notifications notifications namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->notifications->get; $response = $client->notifications->send( to_ids => [ 1, 3 ], notification => 'FBML notification markup', ); $response = $client->notifications->send_email( recipients => [1, 2343, 445], subject => 'subject', text => 'text version of email body', fbml => 'fbml version of email body', ); =item pages pages namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->pages->get_info( page_ids => [@pages], fields => [@fields], uid => 'user', type => 'page type', ); $page_added_app = $client->pages->is_app_added( page_id => 'page' ); $is_admin = $client->pages->is_admin( page_id => 'page' ); $is_fan = $client->pages->is_fan( page_id => 'page', uid => 'uid' ) =item permissions permissions namespace of the API (See L). =item photos photos namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->photos->add_tag( pid => 2, tag_uid => 3, tag_text => "me", x => 5, y => 6 ); $response = $client->photos->create_album( name => 'fun in the sun', location => 'California', description => "Summer '07", ); $response = $client->photos->get( aid => 2, pids => [4,7,8] ); $response = $client->photos->get_albums( uid => 1, pids => [3,5] ); $response = $client->photos->get_tags( pids => [4,5] ); $response = $client->photos->upload( aid => 5, caption => 'beach', data => 'raw data', ); =item profile profile namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->profile->get_fbml( uid => 3 ); $response = $client->profile->set_fbml( uid => 5, profile => 'markup', profile_action => 'markup', mobile_profile => 'markup', ); =item sms sms namespace of the API (See L). =item status status namespace of the API (See L). =item stream stream namespace of the API (See L). =item users users namespace of the API (See L). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->users->get_info( uids => 2343, fields => [ qw/about_me quotes/ ] ); $uid = $client->users->get_logged_in_user; $response = $client->users->has_app_permission( ext_perm => 'status_update|photo_upload' ); $app_added = $client->users->is_app_user; $response = $client->users->set_status( status => 'status message', clear => 1|0, ); =item video video namespace of the API (See L). =back =head1 ATTRIBUTE METHODS These are methods to get/set the object's attributes. =over =item api_key( $new_api_key ) The developer's API key. If C<$ENV{'WFA_API_KEY'}> is set, all instances will be initialized with its value. See the Facebook API documentation for more information. =item api_version( $new_version ) Which version to use (default is "1.0", which is the latest one supported currently). Corresponds to the argument C that is passed in to methods as a parameter. =item app_id() The application id where your Facebook app is described, e.g.: http://www.facebook.com/apps/application.php?id=THIS_NUMBER Remember, C is not that clairvoyant: You must first set this number (when calling C) in order to use it. =item 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 C<"example">. =item apps_uri() The apps uri for Facebook apps. The default is http://apps.facebook.com/. =item callback( $new_default_callback ) The callback URL for your application. See the Facebook API documentation. Just a convenient place holder for the value. =item 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->call_success( 1, undef ); if ( $response->[0] == 1 ) { print 'Last call successful'; } if ( not defined $response->[1] ) { print 'Error message is undefined'; } $client->call_success( 0,'2: The service is not available at this time.'); $response = $client->call_success; if ( not $response->[0] ) { print 'Last call unsuccessful'; } if ( not defined $response->[1] ) { print "Error $response->[1]"; } The C method calls this method, and shouldn't need to be called to set anything, just to get the value later if C is false. =item config($filename) Used when instantiating a new object to set the environment variables. The file has a simple, BASH-style format: WFA_API_KEY_MYAPP=383378efa485934bc WFA_SECRET_MYAPP=234234ac902f340923 WFA_SESSION_KEY_MYAPP=34589349abce989d WFA_DESKTOP_MYAPP=1 If the file is found, and the environment variables are already set, then the variables will not be changed. =item debug(0|1) A boolean set to either true or false, determining if debugging messages should be carped for REST calls. Defaults to 0. =item desktop(0|1) A boolean signifying if the client is being used for a desktop application. If C<$ENV{'WFA_DESKTOP'}> is set, all instances will be initialized with its value. Defaults to 0 otherwise. See the Facebook API documentation for more information. =item 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. =item last_call_success(1|0) A boolean set to true or false, to show whether the last call was succesful or not. Called by C. Defaults to 1. =item last_error( $error_message ) A string holding the error message of the last failed call to the REST server. Called by C. Defaults to undef. =item next( $new_default_next_url ) See the Facebook API documentation's Authentication Guide. Just a convenient place holder for the value. =item 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). =item popup( $popup ) See the Facebook API documentation's Authentication Guide. Just a convenient place holder for the value. =item query( $query ) Stores the current query object to use (either L or L) but really anything that implements the C method can be used. B methods below, Apache::Request will croak because it does not implement a redirect method.> =item secret( $new_secret_key ) For a desktop application, this is the secret that is used for calling C<< auth->create_token >> and C<< auth->get_session >>. For a web application, secret is used for all calls to the API. If C<$ENV{'WFA_SECRET'}> is set, all instances will be initialized with its value. See the Facebook API documentation under Authentication for more information. =item server_uri( $new_server_uri ) The server uri to access the Facebook REST server. Default is C<'http://api.facebook.com/restserver.php'>. Used to make calls to the Facebook server, and useful for testing. See the Facebook API documentation. =item session_expires( $new_expires ) The session expire timestamp for the client's user. Automatically set when C<< $client->auth->get_session >> is called. See the Facebook API documentation. =item session_key( $new_key ) The session key for the client's user. Automatically set when C<< $client->auth->get_session >> is called. See the Facebook API documentation. =item session_uid( $new_uid ) The session's uid for the client's user. Automatically set when C<< $client->auth->get_session >> is called. See the Facebook API documentation. =item skipcookie(0|1) See the Facebook API documentation's Authentication Guide. Just a convenient place holder for the value. =item throw_errors(0|1) A boolean set to either true of false, signifying whether or not to C when an error is returned from the REST server. =item ua The L agent used to communicate with the REST server. The agent_alias is initially set to "Perl-WWW-Facebook-API/0.4.18". =back =head1 PUBLIC METHODS =over =item call( $method, %args ) The method which other submodules within L 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->call( 'auth.getSession', auth_token => 'b3324235e' ); For all calls, if C< parse > is set to true and an empty hash/array reference is returned from facebook, nothing will be returned instead of the empty hash/array reference. =item generate_sig( params => $params_hashref, secret => $secret ) Generates a sig when given a parameters hash reference and a secret key. =item 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 C parameter is passed in, it's string-escaped. Used for platform applications: $response = $client->get_add_url( next => 'http://my.website.com' ); # prints http://www.facebook.com/app.php?api_key=key&v=1.0 # &next=http%3A%2F%2Fmy.website.com print $response; =item get_app_url Returns the URL to your application, if using the Facebook canvas. Uses <$client->app_path>, which you have to set yourself (See below). =item get_facebook_url( $subdomain ) Returns the URL to Facebook. You can specifiy a specific network as a parameter: $response = $client->get_facebook_url( 'apps' ); print $response; # prints http://apps.facebook.com =item get_infinite_session_url() Returns the URL for the user to generate an infinite session for your application: $response = $client->get_infinite_session_url; # prints http://www.facebook.com/codegen.php?api_key=key&v=1.0 print $response; From what I've seen, the session keys that Facebook returns don't expire automatically, so as long as you don't call $client->auth->logout, you shouldn't even need to worry about this. =item get_login_url( %params ) Returns the URL to login to your application with the parameters (that are defined) included. If the C parameter is passed in, it's string-escaped: $response = $client->get_login_url( next => 'http://my.website.com' ); # prints http://www.facebook.com/login.php?api_key=key&v=1.0 # &next=http%3A%2F%2Fmy.website.com print $response; =item get_url( $type, @args ) Called by all the above C methods above. C<$type> can be C<'login'>, C<'app'>, C<'add'>, C<'facebook'>, C<'infinite_session'>, or C<'custom'>. C<@args> contains the query parameters for the the cases when C<$type> is not C<'app'> or C<'facebook'>. In the case of C<'custom'>, the first item in C<@args> is the url path relative to the facebook website. All of the C methods correspond to the ones in the official PHP client. =item 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. =item redirect( $url, $query_object ) Called by C to redirect the user either within the canvas or without. If no <$query_object> is defined, then whatever is in C<< $client->query >> will be used. (See L) If no redirect is required, nothing is returned. That is the only case when there is no return value. If a redirect B required, there are two cases that are covered: =over 4 =item user not logged in If there isn't a user logged in to Facebook's system, then a redirect to the Facebook login page is printed to STDOUT with a next parameter to the appropriate page. The redirect is called with the the CGI module that comes standard with perl. The return value in this case is 1. =item user logged in If the user is logged in to Facebook, and a redirect is required, the necessary FBML is returned: C<< >>. So the return value is the FBML, which you can then print to STDOUT. =back =item require_add( $query ) Redirects the user to what C returns. See C below for the C<$query> parameter. =item require_frame( $query ) Redirects the user to what C '1' )> returns. See C below for the C<$query> parameter. =item require_login( $query ) Redirects the user to what C returns. See C below for the C<$query> parameter. =item require( $what, $query ) The official PHP client has C methods that take no arguments. Logically, you better know what you want to require when you call each of them, so this API consolidates them into one method. The valid values for C<$what> are C<'add'>, C<'frame'>, and C<'login'>. C<$query> is the query object to use (most likely L). If C<$query> is undefined, the value of C< $client->query >> is used. =item session( uid => $uid, key => $session_key, expires => $session_expires ) Sets the C, C, and C all at once. =item 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. =item verify_sig( sig => $expected_sig, params => $params_hashref ) Checks the signature for a given set of parameters against an expected value. =back =head1 PRIVATE METHODS =over =item _add_url_params( %params ) Called by both C and C to process any of their parameters. Prepends the api_key and the version number as parameters and returns the parameter string. =item _check_values_of($params_hashref) Makes sure all the values of the C<$params_hashref> that need to be set are set. Uses the defaults for those values that are needed and not supplied. =item _format_and_check_params( $method, %args ) Format method parameters (given in C<%args>) according to Facebook API specification. Returns a list of items: A hash reference of the newly formatted params (based on C<%params>) and the raw data (and filename, if passed in) if the call is a photo or video upload: ($params, $raw_data, $filename) = $self->_format_and_check_params( $method, %args ); =item _has_error_response( $response ) Determines if the response is an error, and logs it appropriately. Returns true if response is an error, false otherwise. =item is_empty_response( $response ) Determines if the response is an empty hash or array reference. Returns true if the response is empty, false otherwise. =item _post_request( $params_hashref, $sig, $raw_data, $filename ) Used by C to post the request to the REST server and return the response. C<$raw_data> and C<$filename> are used when uploading a photo or video to Facebook. =item _parse($string) Parses the response from a call to the Facebook server to make it a Perl data structure, and returns the result. =item _parser() Returns a new instance of JSON::Any. =item _reformat_response( $params, $response ) Reformats the response according to whether the app is a desktop app, if the response should be parsed (i.e., changed to a Perlish structure), if the response is empty, etc. Returns the reformatted response. =back =head1 DIAGNOSTICS =over =item C<< Unable to load JSON module for parsing: %s >> L 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. =item C<< 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 C is set to the right location. =item C<< Cannot create namespace %s: %s >> Cannot create the needed subclass method. Contact the developer to report. =item C<< Cannot create attribute %s: %s >> Cannot create the needed attribute method. Contact the developer to report. =item C<<_format_and_check_params must be called in list context!>> You're using a private method call and you're not calling it in list context. It returns a list of items, all of which should be interesting to you. =item C<< Cannot open %s >> Cannot open the configuration file. Make sure the filename is correct and that the program has the appropriate permissions. =item C<< Cannot close %s >> Cannot close the configuration file. Make sure the filename is correct and that the program has the appropriate permissions. =back =head1 FAQ =over =item Id numbers returned by Facebook are being rounded. What is the problem? The JSON module that is installed on your system is converting the numbers to Perl and is losing precision in the process. Make sure you have the latest L module installed or L (any recent version of either should work). =item How do I run the examples in the examples directory? There are two types of examples in the examples directory, desktop-based and web-based. With desktop-based, the api key and secret key are prompted for on STDIN, and then the user's browser is opened and directed to the Facebook log in page. Currently, the desktop-based examples pause for 20 seconds to allow for the user to enter in their credentials. With web-based, you have to pass in the api key, secret key, and app path to the constructor, and then place the script at the callback url you specified in the Facebook setup for your application. For instance, when using the web-based example, you might have the following callback url (note the trailing slash): http://www.example.com/facebook-canvas-json/ You have to make sure the required Perl modules are in the C<@INC> path for the web server process, otherwise there will be a 500 Internal Server error. The easiest way to do that is to put the following at the top of the example script (as long as "path-to-perl5-libs" is readable by the web server process): use lib "path-to-perl5-libs"; =item I'm getting the "Multiple values for %s" error from WFA::Canvas. Help? This usually means that your forms are using GET rather than POST to Facebook URLs. Change your forms to use POST and the problem should be resolved. (See RT#31620 and RT#31944 for more information). =back =head1 CONFIGURATION AND ENVIRONMENT WWW::Facebook::API requires no configuration files or environment variables. =head1 DEPENDENCIES L L L L L L =head1 INCOMPATIBILITIES None. =head1 BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to C, or through the web interface at L. =head1 SOURCE REPOSITORY http://github.com/unobe/perl-wfa/tree/master =head1 TESTING There are some live tests included, but they are only run if the following environment variables are set: WFA_API_KEY_TEST WFA_SECRET_TEST WFA_SESSION_KEY_TEST Additionally, if your app is a desktop one, you must set C. Also, the session key must be valid for the API key being used. To enable POD coverage and POD formattings tests, set C to true. To enable L tests, set C<_PERL_TEST_CRITIC> to true. =head1 AUTHOR David Romano C<< >> =head1 CONTRIBUTORS Anthony Bouvier C<< none >> Clayton Scott C<< http://www.matrix.ca >> David Leadbeater C<< http://dgl.cx >> Derek Del Conte C<< derek@delconte.org >> Gisle Aas C<< none >> J. Shirley C<< >> Jim Spath C<< >> Kevin Riggle C<< none >> Larry Mak C<< none >> Louis-Philippe C<< none >> Matt Sickler C<< >> Nick Gerakines C<< >> Olaf Alders C<< >> Patrick Michael Kane C<< >> Ryan D Johnson C<< ryan@innerfence.com >> Sean O'Rourke C<< >> Shawn Van Ittersum C<< none >> Simon Cavalletto C<< >> Skyler Clark C<< none >> Thomas Sibley C<< >> =head1 LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 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. WWW-Facebook-API-0.4.18/t/0000700000175000001440000000000011346642445014226 5ustar dromanousersWWW-Facebook-API-0.4.18/t/md5.t0000644000175000001440000000441611243677735015125 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 3; use strict; use warnings; BEGIN { use_ok('WWW::Facebook::API'); } chdir 't' if -d 't'; my %params = ( v => '1.0', session_key => 'f849e13d7c31bd1815eab65a-3309787', call_id => 1180528987.70698, api_key => 'an amazing summer is awaiting', format => 'XML', method => 'facebook.profile.setFBML', ); my $sig = 'f73d589a6f305f914b0086654f0b7f43'; my $secret = 'garden'; $params{'markup'} = join '', ; my $api = WWW::Facebook::API->new; is $api->generate_sig( params => \%params, secret => $secret ), $sig, 'signature generation okay'; $api->secret($secret); is $api->verify_sig( params => \%params, sig => $sig ), 1, 'verify_sig ok'; __DATA__

Friends With Shared Interests

XXX XXXXXX Darga
19 shared interests XXX XXXXXX interests
XXX XXXXXX Duong
6 shared interests XXX XXXXXX interests
XXX XXXXXX Szakal
5 shared interests XXX XXXXXX interests
XXX XXXXXX Murphy
4 shared interests XXX XXXXXX interests
XXX XXXXXX Park
4 shared interests XXX XXXXXX interests
WWW-Facebook-API-0.4.18/t/video.t0000644000175000001440000000156611303537450015533 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 4; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; my $call = shift; my %h = @_; return [$call, %h] }; } is_deeply $api->video->get_upload_limits, ['video.getUploadLimits'], 'get_upload_limits calls correctly'; is_deeply $api->video->upload, ['video.upload', format => 'JSON' ], 'upload calls correctly'; is_deeply $api->video->upload(format => 'JSON'), ['video.upload', format => 'JSON' ], 'JSON upload calls correctly'; is_deeply $api->video->upload(format => 'XML'), ['video.upload', format => 'XML' ], 'XML upload calls correctly'; WWW-Facebook-API-0.4.18/t/xml.t0000644000175000001440000000240111243700335015207 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More; use WWW::Facebook::API; use strict; use warnings; BEGIN { if ( 3 != grep defined, @ENV{qw/WFA_API_KEY_TEST WFA_SECRET_TEST WFA_SESSION_KEY_TEST/} ) { plan skip_all => 'Live tests require API key, secret, and session'; } plan tests => 4; } my $api = WWW::Facebook::API->new( app_path => 'test', parse => 1, format => 'XML' ); SKIP: { eval q{use Test::Warn}; skip 'Test::Warn required' => 1 if $@; no warnings 'redefine'; local $WWW::Facebook::API::{log_string} = sub {q{}}; $api->debug(1); warnings_are ( sub { $api->events->get }, [ q{}, 'format is XML: setting parse to 0' ], 'warning thrown and is correct'); $api->debug(0); } $api->parse(1); like $api->events->get, qr/\A<\?xml\sversion="1.0"\sencoding="UTF-8"\?>\s+parse, 0, 'parse set to false'; like $api->events->get, qr/\A<\?xml\sversion="1.0"\sencoding="UTF-8"\?>\s+ 29; BEGIN { use_ok('WWW::Facebook::API'); for (@WWW::Facebook::API::namespaces) { use_ok("WWW::Facebook::API::$_"); } } diag("Testing WWW::Facebook::API $WWW::Facebook::API::VERSION"); WWW-Facebook-API-0.4.18/t/links.t0000644000175000001440000000102411243665136015540 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 2; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->links->get, ['links.get'], 'get calls correctly'; is_deeply $api->links->post, ['links.post'], 'post calls correctly'; WWW-Facebook-API-0.4.18/t/pod.t0000644000175000001440000000060711243700127015176 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More; if (!$ENV{'PERL_TEST_POD'}) { plan skip_all => "Skipping Test::Pod tests"; exit; } eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); WWW-Facebook-API-0.4.18/t/internal.t0000644000175000001440000000453011243677706016247 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 19; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( api_key => 1, secret => 2 ); @_ = (); is $api->_add_url_params( next => shift @_, auth_token => shift @_ ), '?api_key=1&v=1.0', 'url params test 1'; @_ = ( ' hi ', 12 ); is $api->_add_url_params( 'canvas', next => shift @_, auth_token => shift @_ ), '?api_key=1&v=1.0&canvas&auth_token=12&next=%20hi%20', 'url params test 2'; @_ = ( ' hi ', 'test', 12 ); is $api->_add_url_params( next => shift @_, canvas => shift @_, auth_token => shift @_ ), '?api_key=1&v=1.0&canvas&auth_token=12&next=%20hi%20', 'url params test 3'; @_ = (); is $api->_add_url_params( next => shift @_, canvas => shift @_, auth_token => shift @_ ), '?api_key=1&v=1.0', 'url params test 4'; my $params; $api->desktop(1); $params = { method => 'auth.hi' }; $api->_check_values_of( $params ); is keys %$params, 5, 'params amount'; ok !exists $params->{'session_key'}, 'session key not set'; is $params->{'method'}, 'facebook.auth.hi', 'method changed'; ok $params->{'call_id'}, 'call_id added'; is $params->{'v'}, '1.0', 'version added'; is $params->{'api_key'}, 1, 'api_key added'; is $params->{'format'}, 'JSON', 'format added'; $api->desktop(0); my $time = time(); $params = { call_id => $time, method => 'hello' }; $api->_check_values_of( $params ); is $params->{'method'}, 'facebook.hello', 'method changed again'; is $params->{'call_id'}, $time, 'time not reset'; is $params->{'session_key'}, q{}, 'session key set from object\'s value'; ok !exists $params->{'callback'}, 'callback not set'; # Mostly just testing that session_key's passed in value is kept... $params = { method => 'hello2', session_key => 'foo' }; $api->_check_values_of( $params ); is $params->{'method'}, 'facebook.hello2', 'method changed again'; is $params->{'session_key'}, q{foo}, 'session key not changed'; ok !exists $params->{'callback'}, 'callback not set'; $api->callback('/new_info'); $params = { call_id => $time, method => 'fun' }; $api->_check_values_of( $params ); is $params->{'callback'}, '/new_info', 'callback set'; WWW-Facebook-API-0.4.18/t/friends.t0000644000175000001440000000201411243664052016046 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 5; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->friends->get, ['friends.get'], 'get calls correctly'; is_deeply $api->friends->get_app_users, ['friends.getAppUsers'], 'get_app_users calls correctly'; is_deeply $api->friends->are_friends( uids1 => 'a', uids2 => 'b' ), [ 'friends.areFriends', uids1 => 'a', uids2 => 'b' ], 'are_friends calls correctly'; is_deeply $api->friends->get_lists( flid => '223324' ), [ 'friends.getLists', flid => '223324' ], 'get_lists calls correctly'; is_deeply $api->friends->get_mutual_friends( target_id => '223324' ), [ 'friends.getMutualFriends', target_id => '223324' ], 'get_mutual_friends calls correctly'; WWW-Facebook-API-0.4.18/t/application.t0000644000175000001440000000107211243677365016735 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 1; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->application->get_public_info( application_id => 1234 ), [ 'Application.getPublicInfo', application_id => 1234 ], 'get_public_info calls correctly'; WWW-Facebook-API-0.4.18/t/config.t0000644000175000001440000000143011243677423015670 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 8; use WWW::Facebook::API; use strict; use warnings; local %ENV; my $api = WWW::Facebook::API->new; for ( qw/api_key secret desktop session_key/ ) { is $api->$_, '', "$_ initialized"; } my $fn = 'wfa'; open my $file, '>', $fn or die "Cannot write to '$fn'"; print { $file } <<"END_CONFIG"; WFA_API_KEY=1 WFA_SECRET=2 WFA_SESSION_KEY=3 WFA_DESKTOP=4 END_CONFIG close $file; $api = WWW::Facebook::API->new( config => 'wfa' ); is $api->api_key, 1, 'api_key set'; is $api->secret, 2, 'secret set'; is $api->session_key, 3, 'session_key set'; is $api->desktop, 4, 'desktop set'; unlink 'wfa'; WWW-Facebook-API-0.4.18/t/fbml.t0000644000175000001440000000240111243677650015344 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 6; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->fbml->delete_custom_tags( names => [1,2,3] ), [ 'fbml.deleteCustomTags', names => [1,2,3] ], 'delete_custom_tags calls correctly'; is_deeply $api->fbml->get_custom_tags( app_id => '123' ), [ 'fbml.getCustomTags', app_id => '123' ], 'get_custom_tags calls correctly'; is_deeply $api->fbml->register_custom_tags( tags => 'json' ), [ 'fbml.registerCustomTags', tags => 'json' ], 'register_custom_tags calls correctly'; is_deeply $api->fbml->refresh_img_src( src => '' ), [ 'fbml.refreshImgSrc', src => '' ], 'refresh image source calls correctly'; is_deeply $api->fbml->refresh_ref_url( url => '' ), [ 'fbml.refreshRefUrl', url => '' ], 'refresh url source calls correctly'; is_deeply $api->fbml->set_ref_handle( handle => '', fbml => '' ), [ 'fbml.setRefHandle', handle => '', fbml => '' ], 'set ref handle calls correctly'; WWW-Facebook-API-0.4.18/t/intl.t0000644000175000001440000000076311243664577015407 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 1; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->intl->get_translations, ['intl.getTranslations'], 'get_translations calls correctly'; WWW-Facebook-API-0.4.18/t/livemessage.t0000644000175000001440000000073611243666203016731 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 1; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->livemessage->send, ['liveMessage.send'], 'send calls correctly'; WWW-Facebook-API-0.4.18/t/parse.t0000644000175000001440000000117711243677776015560 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 11; use strict; use warnings; BEGIN { use_ok('WWW::Facebook::API'); } my $api = WWW::Facebook::API->new( api_key => 1, secret => 1 ); isa_ok $api, 'WWW::Facebook::API'; for ( map { ( qq{"$_"}, $_ ) } q{true}, q{1} ) { is $api->_parse($_), 1, "no ref $_ returns correct"; } for ( map { ( qq{"$_"}, $_ ) } q{false}, q{0} ) { is $api->_parse($_), 0, "no ref $_ returns correct"; } is $api->_parse(q{}), q{}, "no ref q{} returns correct"; WWW-Facebook-API-0.4.18/t/admin.t0000644000175000001440000000236011243677406015517 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 4; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->admin->get_allocation( integration_point_name => 'notifications_per_day' ), [ 'admin.getAllocation', integration_point_name => 'notifications_per_day'], 'get_allocation calls correctly'; is_deeply $api->admin->get_metrics( start_time => 0, end_time => 0, period => 0, metrics => '["active_users", "canvas_page_views"]' ), [ 'admin.getMetrics', start_time => 0, end_time => 0, period => 0, metrics => '["active_users", "canvas_page_views"]' ], 'get_metrics calls correctly'; is_deeply $api->admin->get_app_properties( properties => ["application_name","callback_url"] ), [ 'admin.getAppProperties', properties => ["application_name","callback_url"] ], 'get_app_properties calls correctly'; is_deeply $api->admin->set_app_properties( ), [ 'admin.setAppProperties' ], 'set_app_properties calls correctly'; WWW-Facebook-API-0.4.18/t/status.t0000644000175000001440000000114211243670631015740 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 2; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->status->get( uid => 1234 ), [ 'status.get', uid => 1234 ], 'get calls correctly'; is_deeply $api->status->set( uid => 1234 ), [ 'status.set', uid => 1234 ], 'set calls correctly'; WWW-Facebook-API-0.4.18/t/message.t0000644000175000001440000000101211243674342016040 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 1; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->message->get_threads_in_folder, ['message.getThreadsInFolder'], 'get_threads_in_folder calls correctly'; WWW-Facebook-API-0.4.18/t/feed.t0000644000175000001440000000233111243663075015325 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 5; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->feed->publish_templatized_action( actor_id => 2, title_template => '' ), [ 'feed.publishTemplatizedAction', actor_id => 2, title_template => '' ], 'publish_templatized_action calls correctly'; is_deeply $api->feed->deactivate_template_bundle, [ 'feed.deactivateTemplateBundleById' ], 'deactivate_template_bundle calls correctly'; is_deeply $api->feed->publish_user_action, [ 'feed.publishUserAction' ], 'publish_user_action calls correctly'; is_deeply $api->feed->get_registered_template_bundle, [ 'feed.getRegisteredTemplateBundles' ], 'get_registered_template_bundle calls correctly'; is_deeply $api->feed->get_registered_template_bundle( template_bundle_id => 1 ), [ 'feed.getRegisteredTemplateBundleById', template_bundle_id => 1 ], 'get_registered_template_bundle calls correctly'; WWW-Facebook-API-0.4.18/t/auth.t0000644000175000001440000000544011243677362015373 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More; # Tries use subs 'system', but after use WWW::Facebook::API, didn't work :-( # May have something to do with autogenerating WWW::Facebook::API::* in # API.pm? Anyway, this is needed for testing WWW::Facebook::API::Auth->login BEGIN { *CORE::GLOBAL::system = sub { 0 }; } use WWW::Facebook::API; use strict; use warnings; BEGIN { eval 'use Test::MockObject::Extends'; if ($@) { plan skip_all => 'Tests require Test::MockObject::Extends'; } plan tests => 16; } my $api = Test::MockObject::Extends->new( WWW::Facebook::API->new( api_key => 1, secret => 1, parse_response => 1, desktop => 1, ), ); { local $/ = "\n\n"; $api->set_series( '_post_request', ); } my $auth = WWW::Facebook::API::Auth->new( base => $api ); my $token = $auth->create_token; is $token, '3e4a22bb2f5ed75114b0fc9995ea85f1', 'token correct'; $auth->get_session($token); is $api->session_key, '5f34e11bfb97c762e439e6a5-8055', 'session key correct'; is $api->session_uid, '8055', 'uid correct'; is $api->session_expires, '1173309298', 'expires correct'; is $api->secret, '23489234289342389', 'secret correct'; eval { $auth->get_session; }; ok $@, 'token needed'; $api->desktop(0); $token = $auth->create_token; is $token, '4358934543983b234c4389ef45489456', '!desktop token correct'; $auth->get_session($token); is $api->session_key, '3453498345945943ca343834-4323', '!desktop session key correct'; is $api->session_uid, '34333', '!desktop uid correct'; is $api->session_expires, '1283218372187', '!desktop expires correct'; is $api->secret, '23489234289342389', '!desktop secret unchanged'; eval { $auth->login; }; ok $@, q{can't use login with web app}; $api->desktop(1); if ($^O =~ /darwin|MSWin/ ) { diag q{Sleeping for a bit (so don't fret)...}; is $auth->login, '3e4a22bb2f5ed75114b0fc9995ea85f1', 'login default sleep ok'; } else { eval { $auth->login; }; diag $@; like $@, qr/open browser/, 'login default can\'t open browser'; } my $start_time = time; is $auth->login( sleep => 1, browser => 'dummy' ), '4358934543983b234c4389ef45489456', 'login set sleep ok'; ok time() - $start_time, 'did sleep'; ok $auth->can('logout'), 'logout works'; __DATA__ "3e4a22bb2f5ed75114b0fc9995ea85f1" {"session_key":"5f34e11bfb97c762e439e6a5-8055","uid":"8055","expires":1173309298,"secret":"23489234289342389"} "4358934543983b234c4389ef45489456" {"session_key":"3453498345945943ca343834-4323","uid":"34333","expires":1283218372187,"secret":"344893458934598"} "3e4a22bb2f5ed75114b0fc9995ea85f1" "4358934543983b234c4389ef45489456" WWW-Facebook-API-0.4.18/t/notes.t0000644000175000001440000000125211243666746015563 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 4; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->notes->create, ['notes.create'], 'create calls correctly'; is_deeply $api->notes->delete, ['notes.delete'], 'delete calls correctly'; is_deeply $api->notes->edit, ['notes.edit'], 'edit calls correctly'; is_deeply $api->notes->get, ['notes.get'], 'get calls correctly'; WWW-Facebook-API-0.4.18/t/events.live.t0000644000175000001440000000157311243660737016675 0ustar dromanousers####################################################################### # $Date: 2007-06-28 13:05:21 -0700 (Thu, 28 Jun 2007) $ # $Revision: 120 $ # $Author: david.romano $ # ex: set ts=8 sw=4 et ######################################################################### use Test::More; use WWW::Facebook::API; use strict; use warnings; BEGIN { if ( 3 != grep defined, @ENV{qw/WFA_API_KEY_TEST WFA_SECRET_TEST WFA_SESSION_KEY_TEST/} ) { plan skip_all => 'Live tests require API key, secret, and session'; } plan tests => 2; } my $api = WWW::Facebook::API->new( app_path => 'test' ); my $events = $api->events->get; is ref $events, 'ARRAY', 'get returns array ref'; SKIP: { skip 'No events to get members from' => 1 unless $events->[0]->{'eid'}; is keys %{$api->events->get_members(eid => $events->[0]->{'eid'})}, 4, 'four lists, as per API'; } WWW-Facebook-API-0.4.18/t/pages.t0000644000175000001440000000132311243667624015525 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 4; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->pages->get_info, ['pages.getInfo'], 'get_info calls correctly'; is_deeply $api->pages->is_app_added, ['pages.isAppAdded'], 'is_app_added calls correctly'; is_deeply $api->pages->is_admin, ['pages.isAdmin'], 'is_admin calls correctly'; is_deeply $api->pages->is_fan, ['pages.isFan'], 'is_fan calls correctly'; WWW-Facebook-API-0.4.18/t/api.t0000644000175000001440000001066111243677372015205 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 36; use WWW::Facebook::API; use Encode qw( encode_utf8 ); use strict; use warnings; my $api = WWW::Facebook::API->new( api_key => 1, secret => 1, session_uid => '', session_key => '', session_expires => '' ); isa_ok $api, 'WWW::Facebook::API'; for ( qw/require_frame require_login/ ) { eval { $api->$_ }; like $@, qr/^Can't call method "param"/, "need query for $_"; } # Test global environment settings { local %ENV = %ENV; @ENV{ map { "WFA_$_" } qw/API_KEY SECRET DESKTOP/} = qw/3 2 1/; ## no warnings 'redefine' still warns... :-( local %WWW::Facebook::API::; delete @INC{ grep { m[^WWW/Facebook/API]xms } keys %INC}; require WWW::Facebook::API; my $api = WWW::Facebook::API->new( app_path => 'hey' ); is $api->api_key, 3, 'WFA_API_KEY ok'; is $api->secret, 2, 'WFA_SECRET ok'; is $api->desktop, 1, 'WFA_DESKTOP ok'; } # Test app-specific environment settings { local %ENV = %ENV; @ENV{ map { "WFA_${_}_TEST_ME" } qw/API_KEY SECRET DESKTOP/} = qw/3 2 1/; my $api = WWW::Facebook::API->new( app_path => 'test-me' ); is $api->api_key, 3, 'WFA_API_KEY_TEST_ME ok'; is $api->secret, 2, 'WFA_SECRET_TEST_ME ok'; is $api->desktop, 1, 'WFA_DESKTOP_TEST_ME ok'; } is $api->$_, '', "$_ init ok" for qw(session_uid session_key session_expires); my %final_session = ( uid => 22343, expires => 2343423, key => 'cd324235fe34353', ); $api->session(%final_session); for ( keys %final_session ) { is eval "\$api->session_$_", $final_session{$_}, "session_$_ set ok"; } my @escaped = ( '\"hell\nhath\nno\nfury\"' => qq("hell\nhath\nno\nfury") ); is $api->unescape_string( $escaped[0] ), $escaped[1], 'unescape_string ok'; is $api->get_facebook_url, 'http://www.facebook.com', 'get_facebook_url ok'; is $api->get_facebook_url('apps'), 'http://apps.facebook.com', 'get_facebook_url arg ok'; is $api->_add_url_params, '?api_key=1&v=1.0', '_add_url_params ok'; is $api->_add_url_params( auth_token => 'efdb34342ef' ), '?api_key=1&v=1.0&auth_token=efdb34342ef', '_add_url_params arg ok'; is $api->_add_url_params( next => '" woot "' ), '?api_key=1&v=1.0&next=%22%20woot%20%22', '_add_url_params next escapes ok'; is $api->get_add_url, 'http://www.facebook.com/add.php?api_key=1&v=1.0', 'get_add_url ok'; is $api->get_login_url, 'http://www.facebook.com/login.php?api_key=1&v=1.0', 'get_login_url ok'; is $api->apps_uri, 'http://apps.facebook.com/', 'apps_uri ok'; is $api->app_path, '', 'app_path ok'; $api->app_path('foo'); is $api->app_path, 'foo', 'app_path set ok'; is $api->get_app_url, 'http://apps.facebook.com/foo/', 'get_app_url ok'; # test for passing undef (shouldn't reset value) $api->app_path(undef); is $api->app_path, 'foo', 'app_path not reset'; ## sig stuff my %sig_params = ( params => { method => 'hi' }, secret => 'cool' ); my $sig = '54b12be659505fa965d7fcee080c32ee'; is $api->generate_sig( %sig_params ), $sig, 'sig generate ok'; is $api->verify_sig( sig => $sig, %sig_params ), 1, 'sig verify 1 ok'; $api->secret(delete $sig_params{'secret'}); is $api->verify_sig( sig => $sig, %sig_params ), 1, 'sig verify 2 ok'; $api->secret(''); is $api->verify_sig( sig => $sig, %sig_params ), '', 'sig verify 3 nok'; # call method { no warnings 'redefine'; local $WWW::Facebook::API::{_post_request} = sub { q{} }; my $args = { params => { method => 'hello', secret => 'foo' } }; $api->call( 'hey', %$args ); is $args->{'params'}->{'method'}, 'facebook.hello', 'call method changed'; $args = { ids => [3,4,5,6] }; my $ids = q{}; $WWW::Facebook::API::{_post_request} = sub { $ids = $_[1]->{'ids'}; q{} }; $api->call('method', %$args ); is $ids, '3,4,5,6', 'Array refs flattened'; $args = { unichar => "\x{304b}" }; my $unichar = q{}; $WWW::Facebook::API::{_post_request} = sub { $unichar = $_[1]->{'unichar'}; q{} }; $api->call('method', %$args ); is $unichar, encode_utf8( "\x{304b}" ), 'Unicode param encoded for transmission'; $args = { unichar => encode_utf8( "\x{304b}" ) }; $unichar = q{}; $api->call('method', %$args ); is $unichar, encode_utf8( "\x{304b}" ), 'Raw UTF-8 param left alone for transmission'; } sub redirect_fh { my $old = select shift; my $new = IO::String->new; return ( $old, $new ); } WWW-Facebook-API-0.4.18/t/users.t0000644000175000001440000000167611243671651015575 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 6; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->users->get_logged_in_user, ['users.getLoggedInUser'], 'get_logged_in_user calls correctly'; is_deeply $api->users->get_info, ['users.getInfo'], 'get_info calls correctly'; is_deeply $api->users->has_app_permission, ['users.hasAppPermission'], 'has_app_permission calls correctly'; is_deeply $api->users->is_app_user, ['users.isAppUser'], 'is_app_user calls correctly'; is_deeply $api->users->set_status, ['users.setStatus'], 'set_status calls correctly'; is_deeply $api->users->is_verified, ['users.isVerified'], 'is_verified calls correctly'; WWW-Facebook-API-0.4.18/t/perlcritic.t0000644000175000001440000000111111243700011016533 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More; BEGIN { if (! $ENV{'PERL_TEST_CRITIC'} ) { plan( skip_all => 'Skipping Perl::Critic tests' ); exit; } eval q{require Test::Perl::Critic}; if ( $@ ) { plan( skip_all => "Test::Perl::Critic required for testing PBP compliance" ); } } use Test::Perl::Critic ( -severity => 1, -profile => 't/perlcriticrc' ); Test::Perl::Critic::all_critic_ok(); WWW-Facebook-API-0.4.18/t/upload.jpg0000644000175000001440000000607011076772232016227 0ustar dromanousersÿØÿàJFIFHHÿáExifMM*ÿÛC  !"$"$ÿÛCÿÀ™B"ÿÄÿÄL  !1±AQr‘¡"24aq$BRb¢²Á#&35Cs’Ñ%6Dc‚³Âád„£ðòÿÄÿÄ8 !"AQ13q¡±Áð2BaÑá#$Cbr‘’²ÂÿÚ ?´B… "Š/ÖX aùº¤Â€K(%#é+˜Fb5š„ôÞ!ž%O­E Ì£ÏØµ•3M Ë8KóŠ+q~@E»ÏãTBWj/ÎÎÏâ ‚K︤1~eçü©ñ"`*(«Ö9I$¤ÓË>NãmÃÃÂ#'Ò[”kTK§ ·ÎWÎ=§€‚f¤f–¥‘gæ“å3‡¡<Éí:{êgm ‘Ûû¾«l¶•_SX•™’©0//?.`4Î8‹wDSÏRçiX‚XžZEô¡Ïh¦þôÜvA+ÒÌþ œ“Bnô‰rý9u*íèʤM²ô¥ÇʲzãTžý;`i'me{ww(ðc›=ëXÓgeê4ùyùU…±0Ú]lŽ‚/ _ðs®ª¡„¤=nZšæTô–Õr/î7ÐPŒÖÊr[Õšê¡Kz³]AÂE I°šqÅdbwS­¶o-&‡¤5'¿2» ݵ:çÄ&~mµ0ê95×2´¿`¹ŒæÚK2RòÃEË»ïVﳯlmO¶@Õœ¯Ði*_R‘SÄl}^T‡Ôw×íá*s+˜eú‚ÒsL]a'æ 4wx“¼ Lòl,ÝÒDÅeÜÊééßß»üÑlÄï.C Ì<Á(qË2‚9ßnÈóü ‘Ø…tt1œŽg¨-)À†2÷/ªi2Óî­>a<‹£›*´ãh bšK”ìÔ¢.žAìͪuIîáZTö–uÒI}€¯m¬LQ6³&fi”êàGž efHæZoo¯¾LÈi§–†Od‘ð>{T«lµ²)ÑIÚ*å*‰)¾—^©îP"4$d·Üušd´ë*)zIðRG0'2{”|jz êjTI‚“2èw½ ˜í½…-(Zí!ui–õfºƒ„(RÞ¬×Pp…‰g½¾T„þ"¤a¶—t6 Ó>ÿ’A=°;§J»\Ä,Ê3tùlÀ@·ÍG?rD>ÅuRÆ‚¬p’eÚ>ó—NÀ¨—Ù<©nj£\Ë›È%ù&/Îóšþ§pŠ'Ìz–m¹­DŠtº¨8¦Qf%À”–pJ4Qõ_¸G­§Ë†°ì»i½’ð¿q‰¬/ i¤ï   ô«œÃìSL–ªRŒ³ä¤ ‚7ƒ˜G’À]¬žJù=£aÔ<ö&ªvˆÂa@“WôFO}ÒÈU·X®×©¿Ñ«T|·S­ ¹bӾݡ?ŹIVÛ•KbP@Pª´dj’ïÛÜšú‹óxå=ÏôlV:‘Ìý“׻Ϲm¼Eœx”e™‰#ûV—¬Ÿ8}ÛvÁË`•3PÙû,-EK‘ylýI>øºIT w6Æ[6ÔÏ*Ò…Öî$Eëàìâ¥+XŠUt$¥Ô‹ô(¦ýÄG¯ªÚpo Hr¼–õfºƒ„(RÞ¬×Pp… ­–+k:imß<Ë«yGØ49 ±³êy–ÂÔ†,¹ç×>÷U:#ŠOd '%T©æi¬ß:ܪG×6Ę;Ñ%kj•l~JM¦¥ìÊœÊûúå΃ ³ÖŽC±8Ò˜»‚¶ÒÙäåR’5:˜Å”éÉ–¥Ý’šZ—•3{!ÐVþësDëH°°Šî=R’ŠfWIò´Ø§wn¢0§…°BØÛÌ–ÄÝ×VÄ'.^‹EsIÛq#NU²è?ûhµ´0^WØ ” 4Ç3ˆ¾‰Îo;láðú-!;VYïm¬‡Ý£V@Ê©É\Ž[é&Çñ=ÑÇds&Si’SP’-{yÁ$_½¿œÚ̦l…[Y ¢’=‰p¼"©ƒˆ—ÄfxhUÜiI–Sj-%IXQßp<çA¤ok£^[@Ê!½Y¬Ô÷GÕ&¶69N¦òËO°ð…ª¢ÖBöqv#i±vŒÇ+„±*-è&^`{¬~ìp¢”9WôR¹,¢O2UæŸ £‹›Qñ;<Æ“›µ*\ p‚ø3¶œÛLÌÔQ?„kÉçàì'u¼BÆ{ Ýj†?@ßTp… isÒïS%^JÍœe );tK=ìÁ0½uÐ5~a‰pzARo÷Œ¨ å“oMúÀwf(¶ Eÿ¼V;›ÿ¶ ´ví.Øú±Í®ûL`ž =§èª£ I¤@SL ÍJÝœÅCMÖ:2wGY„Zv\tpðnJӆǛº8NèÒ´æ‡VM¡­EV`ŸdnJÐß%yèªKã¸ÿÌ öBו ì’µKôò›x~0IÅÓµF÷…Ó&‡Š`{°ÀEflG‘Ûí_“¹ae¼ú(*zaçr5a—¿7)—ßäm_ø(T¹g¦J´²BF½ ¡ÄHg³¦í„¨É>¢òû’¡ºbr¶€9€€îÏQù¹‡Smî̯í[ñƒ4ˆ°ÚÄæw;Ü­¹DÕ+,‹‘gEª ô+ð‡)ÌØ#[G*вÔ[M¿d£â#§l®+]‰Ò¢»Ë˜õ0²'íÈ;c­ qOëIßm>ký±BØ¢2T'œè•Hû_ñÜ\rÏÏ+èÓ¦‚b±¤Ûãô2Ú~ô+‚lÐ<~cýŠúVùÜŽ2,ð“Â{§Kþé<(uìõ?Ô8h}I…w¸˜0JG¢»=Hø£ ÌÃÿê& © Ê=‘ψ_œþŸ†Õ1KRCA7×|rœª€$xˆû(…f1Â;<‰ŽQZ¨¶@ö ÇTf,…AN’—=—ŽSgäá]&=Tå9M+äÉL.w«C r¼®U•ÑK™ñ)Š®ÉSO¨9ô‹ið?Î,[@6j¶®ŠjÓüKÊ"6ZÁFuvý$Í»€®³B}î=îU.rޝ’1HÜI0?ÃOQÖEȘÓöiá V†»?²d0úG3/ü‰‚ü˜¾XlÿÕ(=IõSI è„ã~Ÿáâ èÚ¦d›JˆÝÍ *o“Su­éße·tCÔ?]½ÕLtNAçL'ur8MhÒG²ÍzfÍz»‘!>Ð5’®«þ¤w¸¨XŽO É\zjRûÔcÎ=ýW\ÿ·ûæ`ïìÝ3÷CŒ-‡åDÀ£úBŠ@‰6E~ 'Live tests require API key, secret, and session'; } plan tests => 3; } my $api = WWW::Facebook::API->new( app_path => 'test' ); my $fbml_orig = $api->profile->get_fbml(); my $time = time(); ok $api->profile->set_fbml( markup => $time ), 'set fbml'; like $api->profile->get_fbml(), qr{\A ]+ >$time \z }xms, 'get fbml'; ok $api->profile->set_fbml( markup => $fbml_orig ), 'reset fmbl'; WWW-Facebook-API-0.4.18/t/pod-coverage.t0000644000175000001440000000065711243700120016765 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More; if (!$ENV{'PERL_TEST_POD'}) { plan skip_all => "Skipping Pod::Coverage tests"; exit; } eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); WWW-Facebook-API-0.4.18/t/groups.t0000644000175000001440000000142611243664137015745 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More; use WWW::Facebook::API; use strict; use warnings; BEGIN { if ( 3 != grep defined, @ENV{qw/WFA_API_KEY_TEST WFA_SECRET_TEST WFA_SESSION_KEY_TEST/} ) { plan skip_all => 'Live tests require API key, secret, and session'; } plan tests => 2; } my $api = WWW::Facebook::API->new( app_path => 'test' ); my $groups = $api->groups->get; is ref $groups, 'ARRAY', 'get returns array ref'; SKIP: { skip 'No groups to get members from' => 1 unless $groups->[0]->{'gid'}; is keys %{$api->groups->get_members(gid => $groups->[0]->{'gid'})}, 4, 'four lists, as per API'; } WWW-Facebook-API-0.4.18/t/stream.t0000644000175000001440000000262211303541711015705 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 10; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->stream->add_comment(), [ 'stream.addComment' ], 'add_comment calls correctly'; is_deeply $api->stream->add_like(), [ 'stream.addLike' ], 'add_like calls correctly'; is_deeply $api->stream->get(), [ 'stream.get' ], 'get calls correctly'; is_deeply $api->stream->get_comments(), [ 'stream.getComments' ], 'get_comments calls correctly'; is_deeply $api->stream->get_filters(), [ 'stream.getFilters' ], 'get_filters calls correctly'; is_deeply $api->stream->publish(), [ 'stream.publish' ], 'publish calls correctly'; is_deeply $api->stream->publish( action_links => [qw/book cow/] ), [ 'stream.publish', 'action_links' => '["book","cow"]' ], 'publish with action_links calls correctly'; is_deeply $api->stream->remove(), [ 'stream.remove' ], 'remove calls correctly'; is_deeply $api->stream->remove_comment(), [ 'stream.removeComment' ], 'remove_comment calls correctly'; is_deeply $api->stream->remove_like(), [ 'stream.removeLike' ], 'remove_like calls correctly'; WWW-Facebook-API-0.4.18/t/photos.t0000644000175000001440000000364011243667734015750 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 9; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; local *WWW::Facebook::API::call = sub { shift; return [@_] }; is_deeply $api->photos->add_tag( pid => 1, tags => '[{"x":"30.0","y":"30.0","uid":1234567890}]' ), [ 'photos.addTag', pid => 1, tags => '[{"x":"30.0","y":"30.0","uid":1234567890}]' ], 'add_tag calls correctly'; is_deeply $api->photos->create_album( name => 'Foo', location => 'Bar', description => 'Baz' ), [ 'photos.createAlbum', name => 'Foo', location => 'Bar', description => 'Baz' ], 'create_album calls correctly'; is_deeply $api->photos->get, ['photos.get'], 'get calls correctly'; is_deeply $api->photos->get_albums, ['photos.getAlbums'], 'get_albums calls correctly'; is_deeply $api->photos->get_tags, ['photos.getTags'], 'get_tags calls correctly'; is_deeply $api->photos->upload( data => 'foo' ), [ 'photos.upload', data => 'foo' ], 'upload calls correctly'; } SKIP: { if ( 3 != grep defined, @ENV{qw/WFA_API_KEY_TEST WFA_SECRET_TEST WFA_SESSION_KEY_TEST/} ) { skip 'Live tests require API key, secret, and session' => 3; } use File::Spec::Functions 'catfile'; open my $file, '<:raw', catfile('t', 'upload.jpg') or die "Unable to open image file"; local $/ = undef; my $data = <$file>; close $file; my $resp = $api->photos->upload( data => $data ); for ( qw(aid pid owner) ) { ok exists $resp->{$_}, "Storable value for $_ returned"; } } WWW-Facebook-API-0.4.18/t/permissions.t0000644000175000001440000000262711243700070016770 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 4; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->permissions->grant_api_access( permissions_apikey => 'otherappkey', method_arr => '["admin."]' ), [ 'permissions.grantApiAccess', permissions_apikey => 'otherappkey', method_arr => '["admin."]' ], 'grant_api_access calls correctly'; is_deeply $api->permissions->check_available_api_access( permissions_apikey => 'masterappkey' ), [ 'permissions.checkAvailableApiAccess', permissions_apikey => 'masterappkey' ], 'check_available_api_access calls correctly'; is_deeply $api->permissions->revoke_api_access( permissions_apikey => 'revokedappkey' ), [ 'permissions.revokeApiAccess', permissions_apikey => 'revokedappkey' ], 'revoke_api_access calls correctly'; is_deeply $api->permissions->check_granted_api_access( permissions_apikey => 'otherappkey' ), [ 'permissions.checkGrantedApiAccess', permissions_apikey => 'otherappkey' ], 'check_granted_api_access calls correctly'; WWW-Facebook-API-0.4.18/t/perlcriticrc0000644000175000001440000000041711076772231016647 0ustar dromanousersexclude = CodeLayout::RequireTidyCode [-ControlStructures::ProhibitPostfixControls] [-ControlStructures::ProhibitUnlessBlocks] [-Variables::ProhibitPackageVars] [-Miscellanea::RequireRcsKeywords] [-Subroutines::RequireArgUnpacking] [-InputOutput::RequireCheckedSyscalls] WWW-Facebook-API-0.4.18/t/events.t0000644000175000001440000000161011243677611015726 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 6; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); # at least show the right method is being called. { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->events->cancel, ['events.cancel'], 'cancel calls correctly'; is_deeply $api->events->create, ['events.create'], 'create calls correctly'; is_deeply $api->events->edit, ['events.edit'], 'edit calls correctly'; is_deeply $api->events->rsvp, ['events.rsvp'], 'rsvp calls correctly'; is_deeply $api->events->get, ['events.get'], 'get calls correctly'; is_deeply $api->events->get_members, ['events.getMembers'], 'get_members calls correctly'; WWW-Facebook-API-0.4.18/t/fql.t0000644000175000001440000000247611243663471015216 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More; use WWW::Facebook::API; use strict; use warnings; BEGIN { if ( 3 != grep { defined } @ENV{qw/WFA_API_KEY_TEST WFA_SECRET_TEST WFA_SESSION_KEY_TEST/} ) { plan skip_all => 'Live tests require API key, secret, and session'; } plan tests => 4; } my $api = WWW::Facebook::API->new( app_path => 'test' ); my $uid = $api->users->get_logged_in_user; my $time = time(); is keys %{ $api->fql->query( query => <<"")->[0] }, 3, 'fql has info'; SELECT name,status,about_me FROM user WHERE uid=$uid my $empty; my $empty_query = <<""; SELECT pid FROM photo WHERE aid=$time AND owner IN (SELECT uid FROM user WHERE uid=$uid) $empty = $api->fql->query( query => $empty_query ); ok !$empty, 'empty result is empty'; $api->parse(0); $empty = $api->fql->query( query => $empty_query ); is $empty, '{}', 'empty result w/o parse ok'; $api->format('XML'); $empty = $api->fql->query( query => $empty_query ); is $empty, <<"", 'empty result w/o parse and w/XML ok'; # end WWW-Facebook-API-0.4.18/t/notifications.t0000644000175000001440000000155211243677151017277 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 5; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->notifications->get, ['notifications.get'], 'get calls correctly'; is_deeply $api->notifications->get_list, ['notifications.getList'], 'get_list calls correctly'; is_deeply $api->notifications->mark_read, ['notifications.markRead'], 'mark_read calls correctly'; is_deeply $api->notifications->send, ['notifications.send'], 'send calls correctly'; is_deeply $api->notifications->send_email, ['notifications.sendEmail'], 'send_email calls correctly'; WWW-Facebook-API-0.4.18/t/data.t0000644000175000001440000000132711243677426015344 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More; use WWW::Facebook::API; use strict; use warnings; BEGIN { if ( 3 != grep defined, @ENV{qw/WFA_API_KEY_TEST WFA_SECRET_TEST WFA_SESSION_KEY_TEST/} ) { plan skip_all => 'Live tests require API key, secret, and session'; } plan tests => 2; } my $api = WWW::Facebook::API->new( app_path => 'test' ); my $uid = $api->users->get_logged_in_user; ok defined $api->data->set_cookie( uid => $uid, qw/name foo value bar/), 'Cookie created'; ok $api->data->get_cookies( uid => $uid, name => 'foo' ), 'Cookie retrieved'; WWW-Facebook-API-0.4.18/t/sms.t0000644000175000001440000000115011243670377015225 0ustar dromanousers####################################################################### # ex: set ts=8 sw=4 et ######################################################################### use Test::More tests => 2; use WWW::Facebook::API; use strict; use warnings; my $api = WWW::Facebook::API->new( app_path => 'test' ); { no warnings 'redefine'; *WWW::Facebook::API::call = sub { shift; return [@_] }; } is_deeply $api->sms->can_send( uid => 1234 ), [ 'sms.canSend', uid => 1234 ], 'can_send calls correctly'; is_deeply $api->sms->send( uid => 1234 ), [ 'sms.send', uid => 1234 ], 'send calls correctly'; WWW-Facebook-API-0.4.18/Changes0000644000175000001440000003222311346641135015265 0ustar dromanousersRevision history for WWW-Facebook-API 0.4.18 Fri Mar 12 23:39:59 PST 2010 - Fixed Canvas.pm to correctly select MD5-hex value. (Andrey Ilyin)++ - Updated Canvas.pm docs to specify cookie method needed - Updated copyright information 0.4.17 Thu Nov 26 09:48:03 PST 2009 - Updated Stream.publish to automatically call encode action_links to JSON. (Larry Mak)++ - Fixed upload method in Video along with docs (Anthony Bouvier)++ - Updated server call in API.pm to allow a filename to be passed in from the upload methods under Video and Photo. (Anthony Bouvier)++ - Didn't include Canvas testing b/c it looks like the code changes back in August broke the mocking. (It's on the TODO list) - Added format testing for Video.upload 0.4.16 Mon Aug 24 18:43:12 PDT 2009 Added Exception submodule for handling exceptions (Kevin Riggle)++ 0.4.15 Fri Aug 21 22:26:44 PDT 2009 Updated POD and formatting (for Perl::Critic) (gregor herrmann)++ Added new namespaces that are now a part of Facebook API along with basic tests Added documentation for all namespaces in API.pm Deleted deprecated namespaces and methods Added begin and end methods to start and finish permissions mode in Permissions.pm Changed formatting and removed versioning information. Versioning information is no longer specific to each submodule, but to the distribution 0.4.14 Tue Oct 14 22:37;41 EDT 2008 Added Application,Admin,SMS APIs + tests (tburke++) Fixed a bug with get_registered_template_bundle in Feed API (tburke++) 0.4.13 Wed Jul 30 18:14:59 PDT 2008 Added Readonly as dependency 0.4.12 Wed Jul 30 04:09:26 PDT 2008 Perltidy'd Fixed RT#33571 and RT#37617 (gregor herrmann)++ Addresses RT#37840 (clscott++) 0.4.11 Thu Feb 28 20:44:29 PST 2008 Fix documentation bug for notifications->send_email Add FAQ entry for RT#31620 and RT#31944 Regen'ed README Fixed utf8 encoding issue: RT#32500 (thanks for the patch, Ryan) Added get_lists in friends namespace Added data namespace with tests Updated documentation to match various API updates Perltidy'd 0.4.10 Sat Dec 1 17:30:58 PST 2007 Fixed bug where session_key parameter value wasn't being used when passed to a call (thanks Louise-Philippe) Perl-tidied and critiqued Added stub documentation for base and new methods 0.4.9 Sun Nov 25 11:39:47 PST 2007 Fixed some documentation errors Updated documentation to match current documentation on Facebook site Added pages namespace Removed get_FBML and set_FBML in profile namespace 0.4.8 Sun Nov 11 14:37:41 PST 2007 Updated docs and added FAQ with two questions Added marketplace Added users->has_app_permission, users->is_app_added, users->set_status Added feed->publish_templatized_action (thanks Larry Mak) Changed autogen methods for subclasses in API.pm (thanks Shawn) No longer send secret when authenticating (thanks Derek) 0.4.7 Mon Sep 3 18:32:38 PDT 2007 Updated POD and README 0.4.6 Mon Sep 3 18:24:35 PDT 2007 Updated POD and README (and forgot to commit changes ): 0.4.5 Mon Sep 3 16:35:59 PDT 2007 BUG FIX: $api->photos->upload now works as documented BUG FIX: some session keys weren't being parsed correctly, which made later API calls ultimately fail. Updated tests to account for FBML version Some internal refactoring 0.4.4 Sat Jul 28 13:59:17 PDT 2007 Fixed get_infinite_sesion url (codegen => code_gen) Fixed error message carping (only matters in debug mode) Added app_id attribute Commented out tests using IO::String, since they're failing for some people and are not accurately representing the module's functionality 0.4.3 Fri Jul 20 14:55:48 PDT 2007 Fix failing test for when CGI module is greater than 3.15 (t/canvas.t) Try to fix test problem w/IO::String on 5.9.x(?) Make live tests work again (changed SECRET_KEY to SECRET) Run some tests only if AUTHOR_TESTS is set 0.4.2 Sun Jul 15 03:10:07 PDT 2007 *** API CHANGE *** WFA_SECRET_KEY environment variable is now WFA_SECRET Config can now be loaded from a file if specified as a parameter: config => 'file_name' Any calls to Facebook that returned empty hash/array references will now return nothing instead of the empty reference. Reworked require_* and redirect methods to work better. See docs. redirect() now punts to CGI->new->redirect (was $self->query->redirect) Try to fix test failure when checking debug output 0.4.1 Wed Jul 11 07:39:25 PDT 2007 Fixed doc formatting and removed 'update' namespace doc (Thanks Tom Hukins) Fixed require_* methods and added tests (Thanks Skyler Clark) _get_url_params now works when 'canvas' is passed in by itself, or if it's passed in as a key. Removed 'is_app_added' from 'users' namespace Updated test coverage 0.4.0 Tue Jul 10 06:28:44 PDT 2007 Fixed failing test in t/auth.t on linux (Thanks Tom Hukins) Fixed parse => 1 and format => XML bug (added tests) 0.3.9 Sun Jul 8 18:53:57 PDT 2007 Fixed skipped test construct Moved new and base subs for different namespaces into API.pm generator Added tests for canvas methods Added tests for auth methods Added tests for most other namespace methods, some better than others. (Better than nothin') Removed WWW::Facebook::API::Update, since no longer in API. 0.3.8 Sun Jul 8 02:45:58 PDT 2007 FQL->query() now always returns an array reference when using JSON and 'parse' is set to true. (Thanks Jim Spath) Added query() call in examples/facebook-desktop-json for now. Don't call allow_nonref() if JSON::Any isn't using JSON::XS Fixed fql bug when not using JSON and not having $self->parse set. Fixed which secret to be used in call() method. Added quite a few tests Using environment variables for defaults if defined (see docs) Added _parser() for repeated code 0.3.7 Thu Jul 5 07:20:14 PDT 2007 Simpler fix for JSON problem, which fixed some other bugs that cropped up with previous method. (Thanks Skyler Clark) 0.3.6 Fri Jun 29 11:06:53 PDT 2007 Critical bug in 0.3.5 in setting attributes (affects using the canvas) (Thanks Jim Spath) 0.3.5 Thu Jun 28 12:38:24 PDT 2007 Added canvas->get_non_fb_params() (Thanks Matt Sickler) Clarified Canvas documentation for validate_sig() (Thanks Matt Sickler) Refactored get_*_url methods Worked on require_* methods and added docs Added 'query' attribute to API.pm to store current CGI or Apache::Request object. Fixed test coverage table formatting in docs Add JSON::XS nonref fix to _parse (returns from notifications->send haven't been working) (Thanks Matt Sickler and Jim Spath) 0.3.4 Fri Jun 22 19:16:34 PDT 2007 Cleaned up attribute creators and namespace method creators (Thanks Matt Sickler) Added debug message in _parse Require auth_token for get_session() calls (was being set to secret if no token was passed in for web apps, and that was wrong) Edited docs to clarify what needs to be done for web apps to call auth->get_session(). (Thanks Olaf Alders) XML is no longer parsed when the parse flag is true. (Thanks Olaf Alders) Added CONTRIBUTORS section for those who've contributed ideas and code canvas->in_frame now checks for 'in_iframe' rather than erroneous 'in_frame'. Fixed doc example call, too. (Thanks Simon Cavalletto) JSON loading patch (Thanks J. Shirley) 0.3.3 Thu Jun 7 22:26:17 PDT 2007 Ran through Perl::Critic and added tests (not included in MANIFEST) Added method call_success in API.pm to simplify error tracking Added method get_infinite_session_url to API.pm Added test coverage table to the end of API.pm Error message and code is now stored in last_error_message Updated docs (some errors in examples, too) 0.3.2 Sun Jun 3 21:38:20 PDT 2007 *** API CHANGE *** Change auth->login method to comply with Facebook TOS A.9.iv Changed examples accordingly (removed web examples, kept canvas) Added TODO section in API.pm Removed dependency on WWW::Mechanize, and just use LWP::UserAgent 0.3.1 Sun Jun 3 13:46:03 PDT 2007 Fixed POD formatting and synopsis example Updated docs for diagnostics messages Removed internal methods in Auth.pm README now has doc for API.pm 0.3.0 Sun Jun 3 01:16:18 PDT 2007 *** API changes *** JSON::Any is used by default, and parse is on by default, so a Perl data structure will be returned The JSON or XML response is still returned if parse is set to 0 Removed the (now unneeded) parse variables. Removed API::Base, API::Simple, API::Errors Removed Login.pm and moved its login method to Auth.pm Changed get_add_url and get_login_url to take in a hash. Those, along with auth->login now use the _add_url_params method. Added some API tests Updated examples/facebook-{desktop,web}-json to reflect new API Added examples/facebook-{desktop,web}-raw to show XML output on calls Removed examples/facebook-{desktop,web}-xml Updated examples/facebook-canvas-xml and renamed to facebook-canvas-json Fixed bug in get_session parsing Fixed POD errors in API.pm Tests: updated t/auth.t and and t/00.load.t; removed t/api_simple.t Branch Sat Jun 2 01:40:44 PDT 2007 simple is now the default. { NoAttr => 1, SuppressEmpty => 1} is default parse_params for XML Updated docs Updated examples Updated Auth.pm and Base.pm to account for simple change Removed now defunct WWW::Facebook::API::Simple Applied David Leadbeater's patch fixes generat_sig and verify_sig in Base.pm adds get_facebook_url, get_add_url, get_login_url, get_app_url added canvas example 0.2.3 Sat Jun 2 01:59:54 PDT 2007 Add XML::Simple dependency until streamline is complete 0.2.2 Sat Jun 2 01:24:19 PDT 2007 Added method to Base (and paramter to API->new) to configure options passed to XML or JSON parser (if used): parse_params Added generate_sig, verify_sig, session, unescape_string to Base.pm Added is_app_added to Users.pm Perltidy'd examples, and fixed xml parsing dereferencing that was broken in HEAD Fixed parse_params bug (thanks Patrick) Applied patch for Canvas class (thanks David Leadbeater) Changed Canvas methods a bit (semantics the same) parse_response is now set to 1 as the default. 0.2.1 Fri Jun 1 02:55:17 PDT 2007 Removed OSX-specific code in Login.pm (shouldn't cause any major damage, but annoying nonetheless) 0.2.0 Fri Jun 1 02:55:17 PDT 2007 Perltidy'd Updated docs to match current usage Removed Moose and XML::Simple dependency fixed last_call_success method being called on wrong object Updated docs to reflect dependency change 0.1.6 Thu May 31 17:54:39 PDT 2007 fixed 'errors' method calls in Base.pm 0.1.5 Thu May 31 11:15:52 PDT 2007 **** API Change in Errors.pm **** log_debug and log_error are no more. log_string is. applied patch to add FBML methods RT#27351 (thanks Tom) throw_errors flag wasn't being used, and now is (thanks Clayton) autogenerated namespaces in API.pm (saves typing :-) 0.1.4 Wed May 30 06:16:35 PDT 2007 update docs fixed signature generation bug (thanks Shawn) and added test 0.1.3 Tue May 29 19:21:23 PDT 2007 updated docs to have profile and feed 0.1.2 Tue May 29 13:37:23 PDT 2007 listened to wisdom and fixed test dependency problem RT#27305 (thanks Sean) added 'format' attribute to Base returns JSON (raw response) if specified reworked logic for fixing quotes hash refs changed POST to GET for Login->login moved most of 'simple' logic into Base fixed error catching code in Base->call added private method _make_xml_for to create xml if specified changed debugging output to just print raw response made calls in different sub-modules a lot simpler 0.1.1 Mon May 28 22:07:01 PDT 2007 added profile.* and feed.* methods of API added logout method under Auth updated example to use logout method added debugging information added two load tests hash refs under quotes (none which should be refs) are now removed 0.1.0 Mon May 28 07:48:50 PDT 2007 slightly changed how to check for errors updated docs 0.0.9 Mon May 28 06:53:17 PDT 2007 changed from GET to POST for dealing with REST server, since it appears that FB is more strict now about what kind of connection it expects (thanks to Shawn Van Ittersum for the tip) fixed test dependency problem RT#27305 removed URI::Escape from dependency list updated copyright 0.0.8 Sat May 5 11:22:27 PDT 2007 doc coverage and perl-critic tests no longer packaged 0.0.7 Fri May 4 10:08:07 PDT 2007 doc cleanup 0.0.6 Thu May 3 04:42:22 PDT 2007 lots of changes to make module to match API 1.0 added Simple interface removed tests that were not longer useful 0.0.5 Sun Nov 5 00:57:05 2006 updated module to match API: removed Wall.pm changed documentation added tests: messages.t pokes.t session.t 0.0.4 Sat Nov 4 20:57:47 2006 updated module to match API: added friends.getAppUsers added friends.getRequests added session.ping fixed some documentation typos clarified some documentation 0.0.3 Sat Sep 16 14:32:27 2006 Added friends->get_app_users, which was added to the official Facebook API 0.0.2 Sat Sep 16 13:00:24 2006 Initial release. Added more tests Changed module structure slightly - Client/Auth/UserLogin.pm -> Client/Login.pm 0.0.1 Mon Aug 21 13:09:11 2006 Initial development. WWW-Facebook-API-0.4.18/MANIFEST0000644000175000001440000000302311303535230015106 0ustar dromanousersChanges examples/facebook-canvas-json examples/facebook-desktop-json examples/facebook-desktop-raw examples/web-app.pl lib/WWW/Facebook/API.pm lib/WWW/Facebook/API/Admin.pm lib/WWW/Facebook/API/Application.pm lib/WWW/Facebook/API/Auth.pm lib/WWW/Facebook/API/Canvas.pm lib/WWW/Facebook/API/Comments.pm lib/WWW/Facebook/API/Connect.pm lib/WWW/Facebook/API/Data.pm lib/WWW/Facebook/API/Events.pm lib/WWW/Facebook/API/Exception.pm lib/WWW/Facebook/API/FBML.pm lib/WWW/Facebook/API/Feed.pm lib/WWW/Facebook/API/FQL.pm lib/WWW/Facebook/API/Friends.pm lib/WWW/Facebook/API/Groups.pm lib/WWW/Facebook/API/Intl.pm lib/WWW/Facebook/API/Links.pm lib/WWW/Facebook/API/LiveMessage.pm lib/WWW/Facebook/API/Message.pm lib/WWW/Facebook/API/Notes.pm lib/WWW/Facebook/API/Notifications.pm lib/WWW/Facebook/API/Pages.pm lib/WWW/Facebook/API/Permissions.pm lib/WWW/Facebook/API/Photos.pm lib/WWW/Facebook/API/Profile.pm lib/WWW/Facebook/API/SMS.pm lib/WWW/Facebook/API/Status.pm lib/WWW/Facebook/API/Stream.pm lib/WWW/Facebook/API/Users.pm lib/WWW/Facebook/API/Video.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP META.yml README t/00.load.t t/admin.t t/api.t t/application.t t/auth.t t/config.t t/data.t t/events.live.t t/events.t t/fbml.t t/feed.t t/fql.t t/friends.t t/groups.t t/internal.t t/intl.t t/links.t t/livemessage.t t/md5.t t/message.t t/notes.t t/notifications.t t/pages.t t/parse.t t/perlcriticrc t/perlcritic.t t/permissions.t t/photos.t t/pod-coverage.t t/pod.t t/profile.t t/sms.t t/status.t t/stream.t t/upload.jpg t/users.t t/video.t t/xml.t WWW-Facebook-API-0.4.18/examples/0000700000175000001440000000000011346642445015601 5ustar dromanousersWWW-Facebook-API-0.4.18/examples/facebook-canvas-json0000644000175000001440000000525611076772205021535 0ustar dromanousers#!/usr/bin/perl # Copyright David Leadbeater 2007 . # Licensed under the same terms as Perl itself. # A simple example of using WWW::Facebook::API within a facebook canvas. # You will need to change the api_key, secret and app_path below to match your # account. To get an api_key and secret, go to # http://www.facebook.com/developers/editapp.php?new, choose "Use FBML" and # enter a unique name for the canvas which you should put into app_path. use strict; use CGI; use WWW::Facebook::API; use Data::Dumper; my $facebook = WWW::Facebook::API->new( api_key => "change-me", secret => "change-me", app_path => "change-me", parse => 1, ); our %action_map = ( '' => \&index_page, info => \&info_page, ); sub main { # Should also work with FastCGI (via CGI::Fast). my $q = new CGI; print $q->header; redirect("Must be called in facebook canvas") unless $facebook->canvas->in_fb_canvas($q); my $params = $facebook->canvas->validate_sig($q); if ( $params->{user} ) { # Canvas takes care of setting up a session for us, no need to call the # auth methods. $facebook->session_key( $params->{session_key} ); } else { # User hasn't added app (could reject/display info/whatever) # (Or handle later when a user is needed). } my ( $action, $param ) = ( $q->path_info =~ m!^/(\w+)/?(.*)! ); if ( my $s = $action_map{$action} ) { $s->( $param, $params ); } else { div_error("Action unknown"); } # Clear session_key (for if running under FastCGI). $facebook->session_key(undef); } sub index_page { my ( $param, $params ) = @_; print "
"; # You could do this easier by using , just showing some API stuff here. my $name = "You"; if ($params) { my $res = $facebook->fql->query( query => "SELECT first_name FROM user WHERE uid=$params->{user}" ); $name = "Hi $res->[0]->{first_name}, you"; } print "$name ", ( $params ? "have" : "have't" ), " added this application. Some info."; if ( !$params ) { print "Add this application."; } print "
"; } sub info_page { my ( $param, $params ) = @_; print "
";
    print Dumper($params);
    print "
"; } sub redirect { div_error("Please go to facebook" ); exit; } sub div_error { print "
", join( "", @_ ), "
"; } main(); WWW-Facebook-API-0.4.18/examples/facebook-desktop-json0000644000175000001440000000161511346640156021725 0ustar dromanousers#!perl use strict; use warnings; use WWW::Facebook::API; my $client = WWW::Facebook::API->new( desktop => 1, throw_errors => 1, parse => 1, ); print "Enter your public API key: "; chomp( my $val = ); $client->api_key($val); print "Enter your API secret: "; chomp( $val = ); $client->secret($val); my $token = $client->auth->login( sleep => 20 ); $client->auth->get_session($token); use Data::Dumper; my $friends_perl = $client->friends->get; print Dumper $friends_perl; my $query = $client->fql->query( query => 'SELECT name FROM user WHERE uid=' . $client->session_uid ); print Dumper $query; my $notifications_perl = $client->notifications->get; print Dumper $notifications_perl; # Current user's quotes my $quotes_perl = $client->users->get_info( uids => $friends_perl, fields => ['quotes'] ); print Dumper $quotes_perl; $client->auth->logout; WWW-Facebook-API-0.4.18/examples/web-app.pl0000755000175000001440000000435111076772204017506 0ustar dromanousers#!/usr/bin/perl # Copyright (c) 2008 David Romano use strict; use warnings; use CGI; use WWW::Facebook::API; my $APP_NAME = 'ReplaceMe'; my $API_KEY = 'ReplaceMe'; my $SECRET = 'ReplaceMe'; my $DESKTOP = 0; my $facebook = WWW::Facebook::API->new( app_path => $APP_NAME, parse => 1, api_key => $API_KEY, secret => $SECRET, desktop => $DESKTOP, ); my %action_map = ( tos => sub { print q{ Terms of Service Terms of Service
REPLACE WITH OWN TEXT
} }, about => sub { print "The Great New $APP_NAME"; }, '' => sub { my ( $facebook, $uid, @args ) = @_; print qq{

Hello !

}; }, ); start($facebook); sub start { my $facebook = shift; my $fb_params = $facebook->canvas->validate_sig( CGI->new ); my $log_in = $facebook->require_login( undef, next => "$ENV{'PATH_INFO'}?$ENV{'QUERY_STRING'}" ); print $facebook->query->header( -expires => 'now' ); if ($log_in) { print $log_in; return; } else { # store credentials $facebook->session( uid => $fb_params->{'user'}, key => $fb_params->{'session_key'}, expires => $fb_params->{'expires'}, ); if ( !$fb_params->{'added'} ) { $action_map{'tos'}->($facebook); return; } } find_action_for($facebook); return; } sub find_action_for { my $facebook = shift; my ( $action, $uid ); ($action) = ( $facebook->query->path_info =~ m[^/(\w+)] ); if ( exists $ENV{'QUERY_STRING'} ) { ($uid) = $ENV{'QUERY_STRING'} =~ /\bid=([^&]+)/; } if ( my $s = $action_map{$action} ) { my @args = split m[(?query->path_info =~ m[^/(?:\w+)/(.*)] )[0]; @args = () unless @args; $uid ||= $facebook->session_uid; $s->( $facebook, $uid, @args ); } else { print '' ."I don't know how to do $action" .''; } return; } WWW-Facebook-API-0.4.18/examples/facebook-desktop-raw0000644000175000001440000000146511076772205021551 0ustar dromanousers#!perl use strict; use warnings; use WWW::Facebook::API; my $client = WWW::Facebook::API->new( desktop => 1, throw_errors => 1, parse => 0, format => 'XML', ); print "Enter your public API key: "; chomp( my $val = ); $client->api_key($val); print "Enter your API secret: "; chomp($val = ); $client->secret($val); my $token = $client->auth->login( sleep => 20 ); $client->auth->get_session( $token ); use Data::Dumper; my $friends_xml = $client->friends->get; print Dumper $friends_xml; my $notifications_xml = $client->notifications->get; print Dumper $notifications_xml; # Current user's quotes my $quotes_xml = $client->users->get_info( uids => [ $client->session_uid ], fields => ['quotes'] ); print Dumper $quotes_xml; $client->auth->logout; WWW-Facebook-API-0.4.18/README0000644000175000001440000010127411346642130014651 0ustar dromanousersNAME WWW::Facebook::API - Facebook API implementation VERSION This document and others distributed with this module describe WWW::Facebook::API version 0.4.18 SYNOPSIS use WWW::Facebook::API; # @ENV{qw/WFA_API_KEY WFA_SECRET WFA_DESKTOP/} are the initial values, # so use those if you only have one app and don't want to pass in values # to constructor my $client = WWW::Facebook::API->new( desktop => 0, api_key => 'your api key', secret => 'your secret key', ); # Change API key and secret print "Enter your public API key: "; chomp( my $val = ); $client->api_key($val); print "Enter your API secret: "; chomp($val = ); $client->secret($val); # not needed if web app (see $client->canvas->get_fb_params) $client->auth->get_session( $token ); use Data::Dumper; my $friends_perl = $client->friends->get; print Dumper $friends_perl; my $notifications_perl = $client->notifications->get; print Dumper $notifications_perl; # Current user's quotes my $quotes_perl = $client->users->get_info( uids => $friends_perl, fields => ['quotes'] ); print Dumper $quotes_perl; $client->auth->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). As the synopsis states, the following environment variables are used to set the defaults for new instances: WFA_API_KEY WFA_SECRET WFA_SESSION_KEY WFA_DESKTOP Additionally, for each instance that is created, the following environment variables are used if no values are set: WFA_API_KEY_APP_PATH WFA_SECRET_APP_PATH WFA_SESSION_KEY_APP_PATH WFA_DESKTOP_APP_PATH Where "APP_PATH" is replaced by whatever $client->app_path returns, with all non-alphanumeric characters replaced with an underscore and all characters upcased (e.g., foo-bar-baz becomes FOO_BAR_BAZ). 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->new( parse => 1, format => 'JSON', secret => 'application_secret_key', api_key => 'application_key', session_key => 'session_key', session_expires => 'session_expires', session_uid => 'session_uid', desktop => 1, api_version => '1.0', callback => 'callback_url', next => 'next', popup => 'popup', skipcookie => 'skip_cookie', throw_errors => 1, ); $copy = $client->new; NAMESPACE METHODS All method names from the Facebook API are lower_cased instead of CamelCase. admin admin namespace of the API (See WWW::Facebook::API::Admin). application application namespace of the API (See WWW::Facebook::API::Application). auth For desktop apps, these are synonymous: $client->auth->get_session( $client->auth->create_token ); $client->auth->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->param('auth_token') ) { $client->auth->get_session( $q->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->canvas->get_user( $q ) $response = $client->canvas->get_fb_params( $q ) $response = $client->canvas->get_non_fb_params( $q ) $response = $client->canvas->validate_sig( $q ) $response = $client->canvas->in_fb_canvas( $q ) $response = $client->canvas->in_frame( $q ) comments comments namespace of the API (See WWW::Facebook::API::Comments). connect connect namespace of the API (See WWW::Facebook::API::Connect). data data namespace of the API (See WWW::Facebook::API::Data). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->data->set_cookie( uid => 23, qw/name foo value bar/); $cookies = $client->data->get_cookies( uid => 4534, name => 'foo', ); 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->events->get( uid => 'uid', eids => [@eids], start_time => 'utc', end_time => 'utc', rsvp_status => 'attending|unsure|declined|not_replied', ); $response = $client->events->get_members( eid => 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->fbml->set_ref_handle( handle => '', fbml => ''); $response = $client->fbml->refresh_img_src( url => ''); $response = $client->fbml->refresh_ref_url( url => ''); 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->feed->publish_story_to_user( title => 'title', body => 'markup', ... ); $response = $client->feed->publish_action_of_user( title => 'title', body => 'markup', ... ); $response = $client->feed->publish_templatized_action( actor_id => 'title', title_template => 'markup', ... ); fql fql namespace of the API (See WWW::Facebook::API::FQL): $response = $client->fql->query( query => 'FQL query' ); 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->friends->get; $response = $client->friends->get_app_users; $response = $client->friends->are_friends( uids1 => [1,5,8], uids2 => [2,3,4] ); $response = $client->friends->get_lists; 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->groups->get( uid => 234324, gids => [2423,334] ); $response = $client->groups->get_members( gid => 32 ); intl intl namespace of the API (See WWW::Facebook::API::Intl). links links namespace of the API (See WWW::Facebook::API::Links). livemesssage liveMesssage namespace of the API (See WWW::Facebook::API::LiveMesssage). message message namespace of the API (See WWW::Facebook::API::Message). notes notes namespace of the API (See WWW::Facebook::API::Notes). 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->notifications->get; $response = $client->notifications->send( to_ids => [ 1, 3 ], notification => 'FBML notification markup', ); $response = $client->notifications->send_email( recipients => [1, 2343, 445], subject => 'subject', text => 'text version of email body', fbml => 'fbml version of email body', ); pages pages namespace of the API (See WWW::Facebook::API::Pages). All method names from the Facebook API are lower_cased instead of CamelCase: $response = $client->pages->get_info( page_ids => [@pages], fields => [@fields], uid => 'user', type => 'page type', ); $page_added_app = $client->pages->is_app_added( page_id => 'page' ); $is_admin = $client->pages->is_admin( page_id => 'page' ); $is_fan = $client->pages->is_fan( page_id => 'page', uid => 'uid' ) permissions permissions namespace of the API (See WWW::Facebook::API::Permissions). 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->photos->add_tag( pid => 2, tag_uid => 3, tag_text => "me", x => 5, y => 6 ); $response = $client->photos->create_album( name => 'fun in the sun', location => 'California', description => "Summer '07", ); $response = $client->photos->get( aid => 2, pids => [4,7,8] ); $response = $client->photos->get_albums( uid => 1, pids => [3,5] ); $response = $client->photos->get_tags( pids => [4,5] ); $response = $client->photos->upload( aid => 5, caption => 'beach', data => '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->profile->get_fbml( uid => 3 ); $response = $client->profile->set_fbml( uid => 5, profile => 'markup', profile_action => 'markup', mobile_profile => 'markup', ); sms sms namespace of the API (See WWW::Facebook::API::SMS). status status namespace of the API (See WWW::Facebook::API::Status). stream stream namespace of the API (See WWW::Facebook::API::Stream). 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->users->get_info( uids => 2343, fields => [ qw/about_me quotes/ ] ); $uid = $client->users->get_logged_in_user; $response = $client->users->has_app_permission( ext_perm => 'status_update|photo_upload' ); $app_added = $client->users->is_app_user; $response = $client->users->set_status( status => 'status message', clear => 1|0, ); video video namespace of the API (See WWW::Facebook::API::Video). ATTRIBUTE METHODS These are methods to get/set the object's attributes. api_key( $new_api_key ) The developer's API key. If $ENV{'WFA_API_KEY'} is set, all instances will be initialized with its value. See the Facebook API documentation for more information. api_version( $new_version ) Which version to use (default is "1.0", which is the latest one supported currently). Corresponds to the argument "v" that is passed in to methods as a parameter. app_id() The application id where your Facebook app is described, e.g.: http://www.facebook.com/apps/application.php?id=THIS_NUMBER Remember, "WWW::Facebook::API" is not that clairvoyant: You must first set this number (when calling "new()") in order to use it. 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->call_success( 1, undef ); if ( $response->[0] == 1 ) { print 'Last call successful'; } if ( not defined $response->[1] ) { print 'Error message is undefined'; } $client->call_success( 0,'2: The service is not available at this time.'); $response = $client->call_success; if ( not $response->[0] ) { print 'Last call unsuccessful'; } if ( not defined $response->[1] ) { print "Error $response->[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. config($filename) Used when instantiating a new object to set the environment variables. The file has a simple, BASH-style format: WFA_API_KEY_MYAPP=383378efa485934bc WFA_SECRET_MYAPP=234234ac902f340923 WFA_SESSION_KEY_MYAPP=34589349abce989d WFA_DESKTOP_MYAPP=1 If the file is found, and the environment variables are already set, then the variables will not be changed. 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. If $ENV{'WFA_DESKTOP'} is set, all instances will be initialized with its value. Defaults to 0 otherwise. See the Facebook API documentation for more information. 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. query( $query ) Stores the current query object to use (either CGI or Apache::Request) but really anything that implements the "param()" method can be used. N.B. When using "require_*" methods below, Apache::Request will croak because it does not implement a redirect method. secret( $new_secret_key ) For a desktop application, this is the secret that is used for calling "auth->create_token" and "auth->get_session". For a web application, secret is used for all calls to the API. If $ENV{'WFA_SECRET'} is set, all instances will be initialized with its value. See the Facebook API documentation under Authentication for more information. 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->get_session" is called. See the Facebook API documentation. session_key( $new_key ) The session key for the client's user. Automatically set when "$client->auth->get_session" 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->get_session" 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.4.18". 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->call( 'auth.getSession', auth_token => 'b3324235e' ); For all calls, if " parse " is set to true and an empty hash/array reference is returned from facebook, nothing will be returned instead of the empty hash/array reference. generate_sig( params => $params_hashref, secret => $secret ) Generates a sig when given a parameters hash reference and a secret key. 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->get_add_url( next => 'http://my.website.com' ); # prints http://www.facebook.com/app.php?api_key=key&v=1.0 # &next=http%3A%2F%2Fmy.website.com print $response; get_app_url Returns the URL to your application, if using the Facebook canvas. Uses <$client->app_path>, which you have to set yourself (See below). get_facebook_url( $subdomain ) Returns the URL to Facebook. You can specifiy a specific network as a parameter: $response = $client->get_facebook_url( 'apps' ); print $response; # prints http://apps.facebook.com get_infinite_session_url() Returns the URL for the user to generate an infinite session for your application: $response = $client->get_infinite_session_url; # prints http://www.facebook.com/codegen.php?api_key=key&v=1.0 print $response; From what I've seen, the session keys that Facebook returns don't expire automatically, so as long as you don't call $client->auth->logout, you shouldn't even need to worry about this. 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->get_login_url( next => 'http://my.website.com' ); # prints http://www.facebook.com/login.php?api_key=key&v=1.0 # &next=http%3A%2F%2Fmy.website.com print $response; get_url( $type, @args ) Called by all the above "get_*_url" methods above. $type can be 'login', 'app', 'add', 'facebook', 'infinite_session', or 'custom'. @args contains the query parameters for the the cases when $type is not 'app' or 'facebook'. In the case of 'custom', the first item in @args is the url path relative to the facebook website. All of the "get_*_url" methods correspond to the ones in the official PHP client. 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. redirect( $url, $query_object ) Called by "require()" to redirect the user either within the canvas or without. If no <$query_object> is defined, then whatever is in "$client->query" will be used. (See WWW::Facebook::API::Canvas) If no redirect is required, nothing is returned. That is the only case when there is no return value. If a redirect is required, there are two cases that are covered: user not logged in If there isn't a user logged in to Facebook's system, then a redirect to the Facebook login page is printed to STDOUT with a next parameter to the appropriate page. The redirect is called with the the CGI module that comes standard with perl. The return value in this case is 1. user logged in If the user is logged in to Facebook, and a redirect is required, the necessary FBML is returned: "". So the return value is the FBML, which you can then print to STDOUT. require_add( $query ) Redirects the user to what "get_add_url()" returns. See "require()" below for the $query parameter. require_frame( $query ) Redirects the user to what "get_login_url( canvas =" '1' )> returns. See "require()" below for the $query parameter. require_login( $query ) Redirects the user to what "get_login_url()" returns. See "require()" below for the $query parameter. require( $what, $query ) The official PHP client has "require_*" methods that take no arguments. Logically, you better know what you want to require when you call each of them, so this API consolidates them into one method. The valid values for $what are 'add', 'frame', and 'login'. $query is the query object to use (most likely CGI). If $query is undefined, the value of " $client-"query >> is used. session( uid => $uid, key => $session_key, expires => $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 => $expected_sig, params => $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_and_check_params( $method, %args ) Format method parameters (given in %args) according to Facebook API specification. Returns a list of items: A hash reference of the newly formatted params (based on %params) and the raw data (and filename, if passed in) if the call is a photo or video upload: ($params, $raw_data, $filename) = $self->_format_and_check_params( $method, %args ); _has_error_response( $response ) Determines if the response is an error, and logs it appropriately. Returns true if response is an error, false otherwise. is_empty_response( $response ) Determines if the response is an empty hash or array reference. Returns true if the response is empty, false otherwise. _post_request( $params_hashref, $sig, $raw_data, $filename ) Used by "call" to post the request to the REST server and return the response. $raw_data and $filename are used when uploading a photo or video to Facebook. _parse($string) Parses the response from a call to the Facebook server to make it a Perl data structure, and returns the result. _parser() Returns a new instance of JSON::Any. _reformat_response( $params, $response ) Reformats the response according to whether the app is a desktop app, if the response should be parsed (i.e., changed to a Perlish structure), if the response is empty, etc. Returns the reformatted response. 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 namespace %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. "<_format_and_check_params must be called in list context!"> You're using a private method call and you're not calling it in list context. It returns a list of items, all of which should be interesting to you. "Cannot open %s" Cannot open the configuration file. Make sure the filename is correct and that the program has the appropriate permissions. "Cannot close %s" Cannot close the configuration file. Make sure the filename is correct and that the program has the appropriate permissions. FAQ Id numbers returned by Facebook are being rounded. What is the problem? The JSON module that is installed on your system is converting the numbers to Perl and is losing precision in the process. Make sure you have the latest JSON::XS module installed or JSON::DWIW (any recent version of either should work). How do I run the examples in the examples directory? There are two types of examples in the examples directory, desktop-based and web-based. With desktop-based, the api key and secret key are prompted for on STDIN, and then the user's browser is opened and directed to the Facebook log in page. Currently, the desktop-based examples pause for 20 seconds to allow for the user to enter in their credentials. With web-based, you have to pass in the api key, secret key, and app path to the constructor, and then place the script at the callback url you specified in the Facebook setup for your application. For instance, when using the web-based example, you might have the following callback url (note the trailing slash): http://www.example.com/facebook-canvas-json/ You have to make sure the required Perl modules are in the @INC path for the web server process, otherwise there will be a 500 Internal Server error. The easiest way to do that is to put the following at the top of the example script (as long as "path-to-perl5-libs" is readable by the web server process): use lib "path-to-perl5-libs"; I'm getting the "Multiple values for %s" error from WFA::Canvas. Help? This usually means that your forms are using GET rather than POST to Facebook URLs. Change your forms to use POST and the problem should be resolved. (See RT#31620 and RT#31944 for more information). 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 . SOURCE REPOSITORY http://github.com/unobe/perl-wfa/tree/master TESTING There are some live tests included, but they are only run if the following environment variables are set: WFA_API_KEY_TEST WFA_SECRET_TEST WFA_SESSION_KEY_TEST Additionally, if your app is a desktop one, you must set "WFA_DESKTOP_TEST". Also, the session key must be valid for the API key being used. To enable POD coverage and POD formattings tests, set "PERL_TEST_POD" to true. To enable Perl::Critic tests, set "_PERL_TEST_CRITIC" to true. AUTHOR David Romano "" CONTRIBUTORS Anthony Bouvier "none" Clayton Scott "http://www.matrix.ca" David Leadbeater "http://dgl.cx" Derek Del Conte "derek@delconte.org" Gisle Aas "none" J. Shirley "" Jim Spath "" Kevin Riggle "none" Larry Mak "none" Louis-Philippe "none" Matt Sickler "" Nick Gerakines "" Olaf Alders "" Patrick Michael Kane "" Ryan D Johnson "ryan@innerfence.com" Sean O'Rourke "" Shawn Van Ittersum "none" Simon Cavalletto "" Skyler Clark "none" Thomas Sibley "" LICENSE AND COPYRIGHT Copyright (c) 2007-2010, David Romano "". 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. WWW-Facebook-API-0.4.18/META.yml0000600000175000001440000000143511346642446015242 0ustar dromanousers--- #YAML:1.0 name: WWW-Facebook-API version: 0.4.18 abstract: Facebook API implementation author: - David Romano license: perl distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: Crypt::SSLeay: 0 Digest::MD5: 0 JSON::Any: 0 LWP::UserAgent: 0 Readonly: 0 Time::HiRes: 0 version: 0 resources: license: http://dev.perl.org/licenses/ repository: http://github.com/unobe/perl-wfa/ no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.54 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 WWW-Facebook-API-0.4.18/MANIFEST.SKIP0000644000175000001440000000056011076772220015667 0ustar dromanousers# Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bWWW-Facebook-API-\d \bpm_to_blib$ # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# # Avoid Devel::Cover files. \bcover_db\b #Avoid bin directory, for now \bbin/ # Avoid Subversion and git files \.svn \.git WWW-Facebook-API-0.4.18/Makefile.PL0000644000175000001440000000165711243702763015754 0ustar dromanousersuse strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'WWW::Facebook::API', AUTHOR => 'David Romano ', VERSION_FROM => 'lib/WWW/Facebook/API.pm', ABSTRACT_FROM => 'lib/WWW/Facebook/API.pm', LICENSE => 'perl', PL_FILES => {}, PREREQ_PM => { 'version' => 0, 'Crypt::SSLeay' => 0, 'Digest::MD5' => 0, 'JSON::Any' => 0, 'Time::HiRes' => 0, 'LWP::UserAgent' => 0, 'Readonly' => 0, }, META_MERGE => { resources => { license => 'http://dev.perl.org/licenses/', repository => 'http://github.com/unobe/perl-wfa/', } }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'WWW-Facebook-API-*' }, );