Facebook framework
I have (finally) written a working Facebook application, and I can now post here a skeleton for a MyLibrary/Facebook application:
# require
use CGI;
use strict;
use WWW::Facebook::API;
# initialize
my $cgi = CGI->new;
my $fbml = '';
my $facebook = WWW::Facebook::API->new(
api_key => "foo",
secret => "bar",
app_path => "http://url/to/your/script.cgi"
);
# get the user id
my $uid = $facebook->canvas->get_user( $cgi );
# Employ $uid as a key to do things like create a Patron
# resource. Use $uid to look up the user's interests, map
# them to facet/term combinations, and suggest resources.
# Use $uid to find the user's friends, and create more
# relationships.
# create a user interface by stuffing markup into $fbml
# output a HTTP header
print $cgi->header;
# update the user's profile page
print $facebook->profile->set_fbml( markup => $fbml, uid => $uid );
# redirect the user to back to their profile page
print $facebook->redirect( "http://www.facebook.com/profile.php?id=$uid", $cgi );
# done
exit;
I guess I will now have to write something…