1 | =head1 NAME |
---|
2 | |
---|
3 | Facebook::Graph::Cookbook::Recipe2 - Building a Full Web App |
---|
4 | |
---|
5 | =head1 VERSION |
---|
6 | |
---|
7 | version 1.0300 |
---|
8 | |
---|
9 | =head1 DESCRIPTION |
---|
10 | |
---|
11 | A 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 | |
---|
15 | You'll need to have all of the following modules installed in order to run this app (in addition to L<Facebook::Graph>): |
---|
16 | |
---|
17 | L<DateTime::Format::ICal> L<Dancer> L<Template> L<Data::ICal> L<XML::FeedPP> |
---|
18 | |
---|
19 | =head2 Assumptions |
---|
20 | |
---|
21 | This recipe assumes that that you have a Facebook (L<http://www.facebook.com>) account. |
---|
22 | |
---|
23 | 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. |
---|
24 | |
---|
25 | In 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 | |
---|
31 | Go to L<http://apps.facebook.com/developer>. |
---|
32 | |
---|
33 | Click "Allow". |
---|
34 | |
---|
35 | =head2 Step 2: Create your application. |
---|
36 | |
---|
37 | Go to L<http://www.facebook.com/developers/createapp.php> or click "Set Up New Application" from the developer application. |
---|
38 | |
---|
39 | 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. |
---|
40 | |
---|
41 | Agree to the terms of servce. |
---|
42 | |
---|
43 | Click "Create Application". |
---|
44 | |
---|
45 | =head2 Step 3: The Connect tab. |
---|
46 | |
---|
47 | After creating your application, go to the "Connect" tab. |
---|
48 | |
---|
49 | Fill 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 | |
---|
51 | Click "save". |
---|
52 | |
---|
53 | =head2 Step 4: Note your application settings. |
---|
54 | |
---|
55 | 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. |
---|
56 | |
---|
57 | =head2 Step 5: Copy files. |
---|
58 | |
---|
59 | If 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 | |
---|
63 | And 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 | |
---|
70 | Before we can run the app we need to edit the config file. |
---|
71 | |
---|
72 | cd /opt/webapp |
---|
73 | vi config.yml |
---|
74 | |
---|
75 | Specifically 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 | |
---|
79 | To 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 | |
---|
86 | Go 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 | |
---|
92 | Now 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 | |
---|
96 | If 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 | |
---|
98 | For more recipes, check out the L<Facebook::Graph::Cookbook>. |
---|
99 | |
---|
100 | =head1 LEGAL |
---|
101 | |
---|
102 | Facebook::Graph is Copyright 2010 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. |
---|
103 | |
---|
104 | =cut |
---|