release-1.10release-1.9
|
Last change
on this file since 2a42248 was
2a42248,
checked in by Edward Z. Yang <ezyang@mit.edu>, 14 years ago
|
|
Add vanilla Facebook::Graph.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
|
-
Property mode set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | package Facebook::Graph::Publish::Comment; |
|---|
| 2 | BEGIN { |
|---|
| 3 | $Facebook::Graph::Publish::Comment::VERSION = '1.0300'; |
|---|
| 4 | } |
|---|
| 5 | |
|---|
| 6 | use Any::Moose; |
|---|
| 7 | extends 'Facebook::Graph::Publish'; |
|---|
| 8 | |
|---|
| 9 | use constant object_path => '/comments'; |
|---|
| 10 | |
|---|
| 11 | has message => ( |
|---|
| 12 | is => 'rw', |
|---|
| 13 | predicate => 'has_message', |
|---|
| 14 | ); |
|---|
| 15 | |
|---|
| 16 | sub set_message { |
|---|
| 17 | my ($self, $message) = @_; |
|---|
| 18 | $self->message($message); |
|---|
| 19 | return $self; |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | around get_post_params => sub { |
|---|
| 25 | my ($orig, $self) = @_; |
|---|
| 26 | my $post = $orig->($self); |
|---|
| 27 | if ($self->has_message) { |
|---|
| 28 | push @$post, message => $self->message; |
|---|
| 29 | } |
|---|
| 30 | return $post; |
|---|
| 31 | }; |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | no Any::Moose; |
|---|
| 35 | __PACKAGE__->meta->make_immutable; |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | =head1 NAME |
|---|
| 39 | |
|---|
| 40 | Facebook::Graph::Publish::Comment - Publish a comment on a post. |
|---|
| 41 | |
|---|
| 42 | =head1 VERSION |
|---|
| 43 | |
|---|
| 44 | version 1.0300 |
|---|
| 45 | |
|---|
| 46 | =head1 SYNOPSIS |
|---|
| 47 | |
|---|
| 48 | my $fb = Facebook::Graph->new; |
|---|
| 49 | |
|---|
| 50 | $fb->add_comment($comment_id) |
|---|
| 51 | ->set_message('Why so serious?') |
|---|
| 52 | ->publish; |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | =head1 DESCRIPTION |
|---|
| 56 | |
|---|
| 57 | This module gives you quick and easy access to publish comments on posts. |
|---|
| 58 | |
|---|
| 59 | B<ATTENTION:> You must have the C<publish_stream> privilege to use this module. |
|---|
| 60 | |
|---|
| 61 | =head1 METHODS |
|---|
| 62 | |
|---|
| 63 | =head2 set_message ( message ) |
|---|
| 64 | |
|---|
| 65 | Sets the text to post to the wall. |
|---|
| 66 | |
|---|
| 67 | =head3 message |
|---|
| 68 | |
|---|
| 69 | A string of text. |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | =head2 publish ( ) |
|---|
| 74 | |
|---|
| 75 | Posts the data and returns a L<Facebook::Graph::Response> object. The response object should contain the id: |
|---|
| 76 | |
|---|
| 77 | {"id":"1647395831_130068550371568"} |
|---|
| 78 | |
|---|
| 79 | =head1 LEGAL |
|---|
| 80 | |
|---|
| 81 | Facebook::Graph is Copyright 2010 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. |
|---|
| 82 | |
|---|
| 83 | =cut |
|---|
Note: See
TracBrowser
for help on using the repository browser.