JT Smith > Facebook-Graph-1.0500 > Facebook::Graph::Cookbook::Recipe2

Download:
Facebook-Graph-1.0500.tar.gz

Annotate this POD

View/Report Bugs
Source   Latest Release: Facebook-Graph-1.0700

NAME ^

Facebook::Graph::Cookbook::Recipe2 - Building a Full Web App

VERSION ^

version 1.0500

DESCRIPTION ^

A full working web app for those people who like to start hacking from a working example and make it their own.

Prerequisite Modules

You'll need to have all of the following modules installed in order to run this app (in addition to Facebook::Graph):

DateTime::Format::ICal Dancer Template Data::ICal XML::FeedPP

Assumptions

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.

In order to edit this web app you're either going to have to know or be willing to learn Dancer. It's a good little web app server. You can find out more at http://perldancer.org.

RECIPE ^

Step 1: Set up the developer application on Facebook.

Go to http://apps.facebook.com/developer.

Click "Allow".

Step 2: Create your application.

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".

Step 3: The Connect tab.

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.

Click "save".

Step 4: Note your application settings.

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.

Step 5: Copy files.

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 /opt/webapp.

 mkdir -p /opt/webapp
 cp -Rfp Facebook-Graph/eg/recipe2/* /opt/webapp

Step 6: Configure your app.

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 app_id and secret fields with information from our Facebook application settings page. And we need to update the postback with the domain pointing to our server.

Step 7: Start it.

To start the app just type the following command:

 cd /opt/webapp
 perl app.pl

Step 8: Play with it.

Go use the web app. See what it does. Point your browser to:

 http://www.yourapplication.com/

Step 9: Start tinkering.

Now that you know you have a working app, start tinkering. Make it do what you want it to do.

SEE ALSO ^

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.

LEGAL ^

Facebook::Graph is Copyright 2010 - 2012 Plain Black Corporation (http://www.plainblack.com) and is licensed under the same terms as Perl itself.

syntax highlighting: