Changeset 7869e48 for perl/modules/Facebook
- Timestamp:
- Jan 12, 2013, 1:43:13 PM (10 years ago)
- Children:
- e3a0d71, 4485285
- Parents:
- 4626016
- git-author:
- Jason Gross <jgross@mit.edu> (01/12/13 13:13:18)
- git-committer:
- Jason Gross <jgross@mit.edu> (01/12/13 13:43:13)
- Location:
- perl/modules/Facebook/lib/Facebook
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Facebook/lib/Facebook/Graph.pm
r5ef98c7 r7869e48 87 87 } 88 88 89 sub authorize { 89 sub authorize { 90 90 my ($self) = @_; 91 91 return Facebook::Graph::Authorize->new( … … 302 302 my $sarah_bownds = $fb->fetch('sarahbownds'); 303 303 my $perl_page = $fb->fetch('16665510298'); 304 304 305 305 Or better yet: 306 306 … … 311 311 ->request 312 312 ->as_hashref; 313 313 314 314 my $sarahs_picture_uri = $fb->picture('sarahbownds')->get_large->uri_as_string; 315 315 … … 319 319 ->request('https://graph.facebook.com/btaylor') 320 320 ->as_hashref; 321 322 321 322 323 323 =head2 Building A Privileged App 324 324 … … 342 342 my $q = Plack::Request->new($env); 343 343 $fb->request_access_token($q->query_param('code')); 344 344 345 345 Or if you already had the access token: 346 346 347 347 $fb->access_token($token); 348 348 349 349 Get some info: 350 350 … … 419 419 420 420 my $sarah = $fb->fetch('sarahbownds'); 421 421 422 422 my $sarah = $fb->query->find('sarahbownds')->request->as_hashref; 423 423 -
perl/modules/Facebook/lib/Facebook/Graph/Cookbook/Recipe1.pod
r2a42248 r7869e48 64 64 65 65 my $urlmap = Plack::App::URLMap->new; 66 66 67 67 # your code will go here 68 68 69 69 $urlmap->to_app; 70 70 71 All the code we have you add should go in the C<# your code will go here> block, in the order that we have you add it. 72 71 All the code we have you add should go in the C<# your code will go here> block, in the order that we have you add it. 72 73 73 =head2 Step 6: Create your Facebook::Graph object. 74 74 … … 80 80 secret => 'Put Your Application Secret Here', 81 81 ); 82 82 83 83 Now you need the URL you entered in step 3, and the application ID and secret you got in step 4. 84 84 … … 186 186 187 187 sudo plackup --port 80 app.psgi 188 188 189 189 Now we point our browser to: 190 190 191 191 http://www.yourapplication.com/facebook 192 192 193 193 Voila! You have created an authenticated Facebook app. If you would like to see this full program check out C<eg/recipe1.psgi> inside this distribution of L<Facebook::Graph>. 194 194 … … 196 196 =head1 CAVEATS 197 197 198 You should never design an application using all the poor stuff we've done here, like using a shared L<Facebook::Graph> object, not using a Framework/CMS or at least L<Plack::Builder>, not using a templating system, passing the offline access token through the URL, etc. We've made comments about these things as we did them to warn you. These choices were made here B<only> because this is example code who's primary purpose is to show you how to use L<Facebook::Graph>, and not best practices for web development. 198 You should never design an application using all the poor stuff we've done here, like using a shared L<Facebook::Graph> object, not using a Framework/CMS or at least L<Plack::Builder>, not using a templating system, passing the offline access token through the URL, etc. We've made comments about these things as we did them to warn you. These choices were made here B<only> because this is example code who's primary purpose is to show you how to use L<Facebook::Graph>, and not best practices for web development. 199 199 200 200 =head1 SEE ALSO -
perl/modules/Facebook/lib/Facebook/Graph/Cookbook/Recipe2.pod
r2a42248 r7869e48 15 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 16 17 L<DateTime::Format::ICal> L<Dancer> L<Template> L<Data::ICal> L<XML::FeedPP> 17 L<DateTime::Format::ICal> L<Dancer> L<Template> L<Data::ICal> L<XML::FeedPP> 18 18 19 19 =head2 Assumptions … … 65 65 mkdir -p /opt/webapp 66 66 cp -Rfp Facebook-Graph/eg/recipe2/* /opt/webapp 67 67 68 68 =head2 Step 6: Configure your app. 69 69 … … 73 73 vi config.yml 74 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. 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 76 77 77 =head2 Step 7: Start it. -
perl/modules/Facebook/lib/Facebook/Graph/Picture.pm
r2a42248 r7869e48 63 63 64 64 my $fb = Facebook::Graph->new; 65 65 66 66 my $default_picture = $fb->picture('16665510298')->uri_as_string; 67 67 my $large_picture = $fb->picture('16665510298')->get_large->uri_as_string; -
perl/modules/Facebook/lib/Facebook/Graph/Publish.pm
rfe03126 r7869e48 77 77 =head1 DESCRIPTION 78 78 79 This module shouldn't be used by you directly for any purpose. 79 This module shouldn't be used by you directly for any purpose. 80 80 81 81 =head1 LEGAL -
perl/modules/Facebook/lib/Facebook/Graph/Publish/Event.pm
r2a42248 r7869e48 183 183 184 184 {"id":"1647395831_130068550371568"} 185 186 185 186 187 187 =head1 TODO 188 188 -
perl/modules/Facebook/lib/Facebook/Graph/Publish/Post.pm
r2a42248 r7869e48 381 381 =head2 set_privacy ( setting, options ) 382 382 383 A completely optional privacy setting. 383 A completely optional privacy setting. 384 384 385 385 =head2 set_properties ( properties ) … … 425 425 426 426 $post->set_target_countries( ['US'] ); 427 427 428 428 =head3 countries 429 429 … … 436 436 437 437 $post->set_target_regions( [6,53] ); 438 438 439 439 =head3 regions 440 440 … … 448 448 449 449 $post->set_target_cities( [2547804] ); 450 450 451 451 =head3 cities 452 452 … … 460 460 461 461 $post->set_target_locales( [6] ); 462 462 463 463 =head3 locales 464 464 -
perl/modules/Facebook/lib/Facebook/Graph/Query.pm
rb7fa912 r7869e48 79 79 my ($self, $limit) = @_; 80 80 $self->limit($limit); 81 return $self; 81 return $self; 82 82 } 83 83 … … 109 109 my ($self, $offset) = @_; 110 110 $self->offset($offset); 111 return $self; 111 return $self; 112 112 } 113 113 … … 215 215 216 216 my $fb = Facebook::Graph->new; 217 217 218 218 my $perl_page = $fb->find('16665510298') 219 219 ->include_metadata 220 220 ->request 221 221 ->as_hashref; 222 222 223 223 my $sarah_bownds = $fb->find('sarahbownds') 224 224 ->select_fields(qw(id name)) … … 254 254 ->request 255 255 ->as_hashref; 256 256 257 257 The above query, if you were read it like text, says: "Give me the user ids and full names of all users named Dave that have been created since yesterday, and limit the result set to the first 25." 258 258 … … 314 314 =head2 search ( query, context ) 315 315 316 Perform a keyword search on a group of items. 316 Perform a keyword search on a group of items. 317 317 318 318 If you prefer not to search by keyword see the C<from> method. -
perl/modules/Facebook/lib/Facebook/Graph/Role/Uri.pm
r2a42248 r7869e48 24 24 =head1 DESCRIPTION 25 25 26 Provides a C<uri> method in any class which returns a L<URI> object that points to the Facebook Graph API. 26 Provides a C<uri> method in any class which returns a L<URI> object that points to the Facebook Graph API. 27 27 28 28 =head1 LEGAL
Note: See TracChangeset
for help on using the changeset viewer.