source: perl/modules/Facebook/lib/Facebook/Graph/Publish/Comment.pm @ b7fa912

release-1.10release-1.9
Last change on this file since b7fa912 was 2a42248, checked in by Edward Z. Yang <ezyang@mit.edu>, 13 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 
1package Facebook::Graph::Publish::Comment;
2BEGIN {
3  $Facebook::Graph::Publish::Comment::VERSION = '1.0300';
4}
5
6use Any::Moose;
7extends 'Facebook::Graph::Publish';
8
9use constant object_path => '/comments';
10
11has message => (
12    is          => 'rw',
13    predicate   => 'has_message',
14);
15
16sub set_message {
17    my ($self, $message) = @_;
18    $self->message($message);
19    return $self;
20}
21
22
23
24around 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
34no Any::Moose;
35__PACKAGE__->meta->make_immutable;
36
37
38=head1 NAME
39
40Facebook::Graph::Publish::Comment - Publish a comment on a post.
41
42=head1 VERSION
43
44version 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
57This module gives you quick and easy access to publish comments on posts.
58
59B<ATTENTION:> You must have the C<publish_stream> privilege to use this module.
60
61=head1 METHODS
62
63=head2 set_message ( message )
64
65Sets the text to post to the wall.
66
67=head3 message
68
69A string of text.
70
71
72
73=head2 publish ( )
74
75Posts 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
81Facebook::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.