| 1 | package Facebook::Graph::Publish::Photo; | ||||||||||||||
| 2 | 4 | $Facebook::Graph::Publish::Photo::VERSION = '1.1205'; | |||||||||||||
| 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 => '/photos'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | 4 | has message => ( | |||||||||||||
| 9 | is => 'rw', | ||||||||||||||
| 10 | predicate => 'has_message', | ||||||||||||||
| 11 | ); | ||||||||||||||
| 12 | |||||||||||||||
| 13 | 0 | ▶ | sub set_message { | ||||||||||||
|
Subroutine
set_message: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 14 | 0 | my ($self, $message) = @_; | |||||||||||||
| 15 | 0 | $self->message($message); | |||||||||||||
| 16 | 0 | return $self; | |||||||||||||
| 17 | } | ||||||||||||||
| 18 | |||||||||||||||
| 19 | 4 | has source => ( | |||||||||||||
| 20 | is => 'rw', | ||||||||||||||
| 21 | predicate => 'has_source', | ||||||||||||||
| 22 | ); | ||||||||||||||
| 23 | |||||||||||||||
| 24 | 0 | ▶ | sub set_source { | ||||||||||||
|
Subroutine
set_source: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 25 | 0 | my ($self, $source) = @_; | |||||||||||||
| 26 | 0 | $self->source($source); | |||||||||||||
| 27 | 0 | return $self; | |||||||||||||
| 28 | } | ||||||||||||||
| 29 | |||||||||||||||
| 30 | 4 | has url => ( | |||||||||||||
| 31 | is => 'rw', | ||||||||||||||
| 32 | predicate => 'has_url', | ||||||||||||||
| 33 | ); | ||||||||||||||
| 34 | |||||||||||||||
| 35 | 0 | ▶ | sub set_url { | ||||||||||||
|
Subroutine
set_url: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 36 | 0 | my ($self, $url) = @_; | |||||||||||||
| 37 | 0 | $self->url($url); | |||||||||||||
| 38 | 0 | return $self; | |||||||||||||
| 39 | } | ||||||||||||||
| 40 | |||||||||||||||
| 41 | 0 | ▶ | around get_post_params => sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||
| 42 | 0 | my ($orig, $self) = @_; | |||||||||||||
| 43 | |||||||||||||||
| 44 | 0 | my $post = $orig->($self); | |||||||||||||
| 45 | |||||||||||||||
| 46 | 0 | ▶ | if ($self->has_message) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 47 | 0 | push @$post, message => $self->message; | |||||||||||||
| 48 | } | ||||||||||||||
| 49 | |||||||||||||||
| 50 | 0 | ▶ | if ($self->has_url) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 51 | 0 | push @$post, url => [$self->url]; | |||||||||||||
| 52 | } elsif ($self->has_source) { | ||||||||||||||
| 53 | 0 | push @$post, source => [$self->source]; | |||||||||||||
| 54 | } | ||||||||||||||
| 55 | |||||||||||||||
| 56 | 0 | ▶ | return $self->has_url ? $post : ( Content_Type => 'form-data', Content => $post ); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 57 | 4 | }; | |||||||||||||
| 58 | |||||||||||||||
| 59 | 4 | 1; | |||||||||||||
| 60 | |||||||||||||||
| 61 | =head1 NAME | ||||||||||||||
| 62 | |||||||||||||||
| 63 | Facebook::Graph::Publish::Photo - Publish Photos | ||||||||||||||
| 64 | |||||||||||||||
| 65 | =head1 VERSION | ||||||||||||||
| 66 | |||||||||||||||
| 67 | version 1.1205 | ||||||||||||||
| 68 | |||||||||||||||
| 69 | =head1 SYNOPSIS | ||||||||||||||
| 70 | |||||||||||||||
| 71 | my $fb = Facebook::Graph->new; | ||||||||||||||
| 72 | |||||||||||||||
| 73 | $fb->add_photo() | ||||||||||||||
| 74 | ->set_source('/tmp/photo.jpg') | ||||||||||||||
| 75 | ->set_message('Photo!') | ||||||||||||||
| 76 | ->publish; | ||||||||||||||
| 77 | |||||||||||||||
| 78 | =head1 DESCRIPTION | ||||||||||||||
| 79 | |||||||||||||||
| 80 | Publish a Photo | ||||||||||||||
| 81 | |||||||||||||||
| 82 | B<ATTENTION:> You must have the C<publish_stream> privilege to use this module. | ||||||||||||||
| 83 | |||||||||||||||
| 84 | =head1 METHODS | ||||||||||||||
| 85 | |||||||||||||||
| 86 | =head2 publish ( ) | ||||||||||||||
| 87 | |||||||||||||||
| 88 | Posts the data and returns a L<Facebook::Graph::Response> object. The response object should contain a string of either 'true' or 'false'. | ||||||||||||||
| 89 | |||||||||||||||
| 90 | =head1 LEGAL | ||||||||||||||
| 91 | |||||||||||||||
| 92 | Facebook::Graph is Copyright 2010 - 2017 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. | ||||||||||||||
| 93 | |||||||||||||||
| 94 | =cut | ||||||||||||||