| 1 | package Facebook::Graph::Publish::Link; | ||||||||||
| 2 | 4 | $Facebook::Graph::Publish::Link::VERSION = '1.1101'; | |||||||||
| 3 | 4 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | extends 'Facebook::Graph::Publish'; | |||||||||
| 5 | |||||||||||
| 6 | 4 | ▶ | use constant object_path => '/links'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 4 | has message => ( | |||||||||
| 9 | is => 'rw', | ||||||||||
| 10 | predicate => 'has_message', | ||||||||||
| 11 | ); | ||||||||||
| 12 | |||||||||||
| 13 | sub set_message { | ||||||||||
| 14 | 0 | ▶ | my ($self, $message) = @_; | ||||||||
|
Subroutine
set_message: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 15 | 0 | $self->message($message); | |||||||||
| 16 | 0 | return $self; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 4 | has link_uri => ( | |||||||||
| 20 | is => 'rw', | ||||||||||
| 21 | predicate => 'has_link_uri', | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | sub set_link_uri { | ||||||||||
| 25 | 0 | ▶ | my ($self, $link_uri) = @_; | ||||||||
|
Subroutine
set_link_uri: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 26 | 0 | $self->link_uri($link_uri); | |||||||||
| 27 | 0 | return $self; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | around get_post_params => sub { | ||||||||||
| 33 | 0 | ▶ | my ($orig, $self) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 34 | 0 | my $post = $orig->($self); | |||||||||
| 35 | 0 | ▶ | if ($self->has_message) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | push @$post, message => $self->message; | |||||||||
| 37 | } | ||||||||||
| 38 | 0 | ▶ | if ($self->has_link_uri) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | push @$post, link => $self->link_uri; | |||||||||
| 40 | } | ||||||||||
| 41 | 0 | return $post; | |||||||||
| 42 | 4 | }; | |||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | 4 | 1; | |||||||||
| 46 | |||||||||||
| 47 | =head1 NAME | ||||||||||
| 48 | |||||||||||
| 49 | Facebook::Graph::Publish::Link - Add a link. | ||||||||||
| 50 | |||||||||||
| 51 | =head1 VERSION | ||||||||||
| 52 | |||||||||||
| 53 | version 1.1101 | ||||||||||
| 54 | |||||||||||
| 55 | =head1 SYNOPSIS | ||||||||||
| 56 | |||||||||||
| 57 | my $fb = Facebook::Graph->new; | ||||||||||
| 58 | |||||||||||
| 59 | $fb->add_link | ||||||||||
| 60 | ->set_link_uri('http://www.plainblack.com') | ||||||||||
| 61 | ->set_message('Plain Black') | ||||||||||
| 62 | ->publish; | ||||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | =head1 DESCRIPTION | ||||||||||
| 66 | |||||||||||
| 67 | This module gives you quick and easy access to publish notes. | ||||||||||
| 68 | |||||||||||
| 69 | B<ATTENTION:> You must have the C<publish_stream> privilege to use this module. | ||||||||||
| 70 | |||||||||||
| 71 | =head1 METHODS | ||||||||||
| 72 | |||||||||||
| 73 | =head2 to ( id ) | ||||||||||
| 74 | |||||||||||
| 75 | Specify a profile id to post to. Defaults to 'me', which is the currently logged in user. | ||||||||||
| 76 | |||||||||||
| 77 | |||||||||||
| 78 | =head2 set_message ( message ) | ||||||||||
| 79 | |||||||||||
| 80 | Sets the description of the link. | ||||||||||
| 81 | |||||||||||
| 82 | =head3 message | ||||||||||
| 83 | |||||||||||
| 84 | A string of text. | ||||||||||
| 85 | |||||||||||
| 86 | |||||||||||
| 87 | =head2 set_link_uri ( uri ) | ||||||||||
| 88 | |||||||||||
| 89 | Sets the URI to link to. | ||||||||||
| 90 | |||||||||||
| 91 | =head3 uri | ||||||||||
| 92 | |||||||||||
| 93 | A URI. | ||||||||||
| 94 | |||||||||||
| 95 | |||||||||||
| 96 | |||||||||||
| 97 | =head2 publish ( ) | ||||||||||
| 98 | |||||||||||
| 99 | Posts the data and returns a L<Facebook::Graph::Response> object. The response object should contain the id: | ||||||||||
| 100 | |||||||||||
| 101 | {"id":"1647395831_130068550371568"} | ||||||||||
| 102 | |||||||||||
| 103 | =head1 LEGAL | ||||||||||
| 104 | |||||||||||
| 105 | Facebook::Graph is Copyright 2010 - 2012 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. | ||||||||||
| 106 | |||||||||||
| 107 | =cut | ||||||||||