1=head1 NAME 2 3Facebook::Graph::Cookbook::Recipe2 - Building a Full Web App 4 5=head1 VERSION 6 7version 1.0801 8 9=head1 DESCRIPTION 10 11A full working web app for those people who like to start hacking from a working example and make it their own. 12 13=head2 Prerequisite Modules 14 15You'll need to have all of the following modules installed in order to run this app (in addition to L<Facebook::Graph>): 16 17L<DateTime::Format::ICal> L<Dancer> L<Template> L<Data::ICal> L<XML::FeedPP> 18 19=head2 Assumptions 20 21This recipe assumes that you have a Facebook (L<http://www.facebook.com>) account. 22 23You'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. 24 25In order to edit this web app you're either going to have to know or be willing to learn L<Dancer>. It's a good little web app server. You can find out more at L<http://perldancer.org>. 26 27=head1 RECIPE 28 29=head2 Step 1: Set up the developer application on Facebook. 30 31Go to L<http://apps.facebook.com/developer>. 32 33Click "Allow". 34 35=head2 Step 2: Create your application. 36 37Go to L<http://www.facebook.com/developers/createapp.php> or click "Set Up New Application" from the developer application. 38 39Fill in an application name. The only restriction is that it can't use a Facebook trademark or be similar to official Facebook application names. 40 41Agree to the terms of service. 42 43Click "Create Application". 44 45=head2 Step 3: The Connect tab. 46 47After creating your application, go to the "Connect" tab. 48 49Fill in the "Connect URL" field. It should be C<http://www.yourapplication.com/>. It is the base URL to where you'll be deploying your application. The trailing slash is required. 50 51Click "save". 52 53=head2 Step 4: Note your application settings. 54 55You 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. 56 57=head2 Step 5: Copy files. 58 59If you don't already have it downloaded, download a tarball of Facebook::Graph and extract it: 60 61 tar xfz Facebook-Graph-0.0700.tar.gz 62 63And copy the files from C<eg/recipe2> where ever you want to deploy your app. For this example we'll assume you want to deploy from C</opt/webapp>. 64 65 mkdir -p /opt/webapp 66 cp -Rfp Facebook-Graph/eg/recipe2/* /opt/webapp 67 68=head2 Step 6: Configure your app. 69 70Before we can run the app we need to edit the config file. 71 72 cd /opt/webapp 73 vi config.yml 74 75Specifically we need to set the C<app_id> and C<secret> fields with information from our Facebook application settings page. And we need to update the C<postback> with the domain pointing to our server. 76 77=head2 Step 7: Start it. 78 79To start the app just type the following command: 80 81 cd /opt/webapp 82 perl app.pl 83 84=head2 Step 8: Play with it. 85 86Go use the web app. See what it does. Point your browser to: 87 88 http://www.yourapplication.com/ 89 90=head2 Step 9: Start tinkering. 91 92Now that you know you have a working app, start tinkering. Make it do what you want it to do. 93 94=head1 SEE ALSO 95 96If you would like a step by step as to how this app was created, download the PDF presentation (L<http://www.madmongers.org/talks/writing-facebook-apps-in-10-minutes-or-less>) I gave of this app at MadMongers (L<http://www.madmongers.org>). 97 98For more recipes, check out the L<Facebook::Graph::Cookbook>. 99 100=head1 LEGAL 101 102Facebook::Graph is Copyright 2010 - 2012 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. 103 104=cut 105