- SEE ALSO
Facebook::Graph::Cookbook::Recipe2 - Building a Full Web App
A full working web app for those people who like to start hacking from a working example and make it their own.
You'll need to have all of the following modules installed in order to run this app (in addition to Facebook::Graph):
This recipe assumes that that you have a Facebook (http://www.facebook.com) account.
You'll also have to be able to point a domain name to a server that is accessible from the Internet. DNS and server configuration are way beyond the scope of this document.
Go to http://www.facebook.com/developers/createapp.php or click "Set Up New Application" from the developer application.
Fill in an application name. The only restriction is that it can't use a Facebook trademark or be similar to official Facebook application names.
Agree to the terms of servce.
Click "Create Application".
After creating your application, go to the "Connect" tab.
Fill in the "Connect URL" field. It should be
http://www.yourapplication.com/. It is the base URL to where you'll be deploying your application. The trailing slash is required.
You either want to make note of your "Application ID" and your "Application Secret" or bookmark this page so you can come back to it. You'll need these later.
If you don't already have it downloaded, download a tarball of Facebook::Graph and extract it:
tar xfz Facebook-Graph-0.0700.tar.gz
And copy the files from
eg/recipe2 where ever you want to deploy your app. For this example we'll assume you want to deploy from
mkdir -p /opt/webapp cp -Rfp Facebook-Graph/eg/recipe2/* /opt/webapp
Before we can run the app we need to edit the config file.
cd /opt/webapp vi config.yml
Specifically we need to set the
secret fields with information from our Facebook application settings page. And we need to update the
postback with the domain pointing to our server.
To start the app just type the following command:
cd /opt/webapp perl app.pl
Go use the web app. See what it does. Point your browser to:
Now that you know you have a working app, start tinkering. Make it do what you want it to do.
If you would like a step by step as to how this app was created, download the PDF presentation (http://www.madmongers.org/talks/writing-facebook-apps-in-10-minutes-or-less) I gave of this app at MadMongers (http://www.madmongers.org).
For more recipes, check out the Facebook::Graph::Cookbook.
Facebook::Graph is Copyright 2010 - 2012 Plain Black Corporation (http://www.plainblack.com) and is licensed under the same terms as Perl itself.