| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Facebook::Graph::Publish::Photo; |
|
2
|
|
|
|
|
|
|
$Facebook::Graph::Publish::Photo::VERSION = '1.1203'; |
|
3
|
4
|
|
|
4
|
|
24
|
use Moo; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
|
|
extends 'Facebook::Graph::Publish'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
1098
|
use constant object_path => '/photos'; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
1068
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has message => ( |
|
9
|
|
|
|
|
|
|
is => 'rw', |
|
10
|
|
|
|
|
|
|
predicate => 'has_message', |
|
11
|
|
|
|
|
|
|
); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub set_message { |
|
14
|
0
|
|
|
0
|
0
|
|
my ($self, $message) = @_; |
|
15
|
0
|
|
|
|
|
|
$self->message($message); |
|
16
|
0
|
|
|
|
|
|
return $self; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has source => ( |
|
20
|
|
|
|
|
|
|
is => 'rw', |
|
21
|
|
|
|
|
|
|
predicate => 'has_source', |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub set_source { |
|
25
|
0
|
|
|
0
|
0
|
|
my ($self, $source) = @_; |
|
26
|
0
|
|
|
|
|
|
$self->source($source); |
|
27
|
0
|
|
|
|
|
|
return $self; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has url => ( |
|
31
|
|
|
|
|
|
|
is => 'rw', |
|
32
|
|
|
|
|
|
|
predicate => 'has_url', |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub set_url { |
|
36
|
0
|
|
|
0
|
0
|
|
my ($self, $url) = @_; |
|
37
|
0
|
|
|
|
|
|
$self->url($url); |
|
38
|
0
|
|
|
|
|
|
return $self; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
around get_post_params => sub { |
|
42
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $post = $orig->($self); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
if ($self->has_message) { |
|
47
|
|
|
|
|
|
|
push @$post, message => $self->message; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
if ($self->has_url) { |
|
51
|
|
|
|
|
|
|
push @$post, url => [$self->url]; |
|
52
|
|
|
|
|
|
|
} elsif ($self->has_source) { |
|
53
|
|
|
|
|
|
|
push @$post, source => [$self->source]; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return $self->has_url ? $post : ( Content_Type => 'form-data', Content => $post ); |
|
57
|
|
|
|
|
|
|
}; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Facebook::Graph::Publish::Photo - Publish Photos |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 1.1203 |
|
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 - 2012 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |