| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Facebook; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
1
|
|
|
1
|
|
23888
|
$Facebook::AUTHORITY = 'cpan:GETTY'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
BEGIN { |
|
6
|
1
|
|
|
1
|
|
20
|
$Facebook::VERSION = '0.102'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
|
|
|
|
|
|
# ABSTRACT: Facebook SDK in Perl |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
4306
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Carp qw/croak/; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use namespace::autoclean; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has desktop => ( |
|
17
|
|
|
|
|
|
|
isa => 'Bool', |
|
18
|
|
|
|
|
|
|
is => 'ro', |
|
19
|
|
|
|
|
|
|
required => 1, |
|
20
|
|
|
|
|
|
|
lazy => 1, |
|
21
|
|
|
|
|
|
|
default => sub { 0 }, |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has uid => ( |
|
25
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
26
|
|
|
|
|
|
|
is => 'rw', |
|
27
|
|
|
|
|
|
|
lazy => 1, |
|
28
|
|
|
|
|
|
|
default => sub { |
|
29
|
|
|
|
|
|
|
my $self = shift; |
|
30
|
|
|
|
|
|
|
$self->signed->uid; |
|
31
|
|
|
|
|
|
|
}, |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has app_id => ( |
|
35
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
36
|
|
|
|
|
|
|
is => 'rw', |
|
37
|
|
|
|
|
|
|
lazy => 1, |
|
38
|
|
|
|
|
|
|
default => sub { |
|
39
|
|
|
|
|
|
|
my $self = shift; |
|
40
|
|
|
|
|
|
|
$self->signed->app_id; |
|
41
|
|
|
|
|
|
|
}, |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has api_key => ( |
|
45
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
46
|
|
|
|
|
|
|
is => 'rw', |
|
47
|
|
|
|
|
|
|
lazy => 1, |
|
48
|
|
|
|
|
|
|
default => sub { croak 'api_key is required' }, |
|
49
|
|
|
|
|
|
|
); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has secret => ( |
|
52
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
53
|
|
|
|
|
|
|
is => 'rw', |
|
54
|
|
|
|
|
|
|
lazy => 1, |
|
55
|
|
|
|
|
|
|
default => sub { |
|
56
|
|
|
|
|
|
|
my $self = shift; |
|
57
|
|
|
|
|
|
|
$self->signed->secret; |
|
58
|
|
|
|
|
|
|
}, |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has access_token => ( |
|
62
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
63
|
|
|
|
|
|
|
is => 'ro', |
|
64
|
|
|
|
|
|
|
lazy => 1, |
|
65
|
|
|
|
|
|
|
default => sub { |
|
66
|
|
|
|
|
|
|
my $self = shift; |
|
67
|
|
|
|
|
|
|
$self->signed->access_token; |
|
68
|
|
|
|
|
|
|
}, |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has access_token_secret => ( |
|
72
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
73
|
|
|
|
|
|
|
is => 'ro', |
|
74
|
|
|
|
|
|
|
lazy => 1, |
|
75
|
|
|
|
|
|
|
default => sub { |
|
76
|
|
|
|
|
|
|
my $self = shift; |
|
77
|
|
|
|
|
|
|
$self->signed->access_token_secret; |
|
78
|
|
|
|
|
|
|
}, |
|
79
|
|
|
|
|
|
|
); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
has signed => ( |
|
82
|
|
|
|
|
|
|
isa => 'Facebook::Signed', |
|
83
|
|
|
|
|
|
|
is => 'ro', |
|
84
|
|
|
|
|
|
|
lazy => 1, |
|
85
|
|
|
|
|
|
|
default => sub { croak 'signed values are required' }, |
|
86
|
|
|
|
|
|
|
predicate => 'has_signed', |
|
87
|
|
|
|
|
|
|
); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
has graph_class => ( |
|
90
|
|
|
|
|
|
|
isa => 'Str', |
|
91
|
|
|
|
|
|
|
is => 'ro', |
|
92
|
|
|
|
|
|
|
default => sub { 'Facebook::Graph' }, |
|
93
|
|
|
|
|
|
|
); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
has graph_api => ( |
|
96
|
|
|
|
|
|
|
is => 'ro', |
|
97
|
|
|
|
|
|
|
lazy => 1, |
|
98
|
|
|
|
|
|
|
default => sub { |
|
99
|
|
|
|
|
|
|
my $self = shift; |
|
100
|
|
|
|
|
|
|
my $graph_class_file = $self->graph_class; |
|
101
|
|
|
|
|
|
|
$graph_class_file =~ s/::/\//g; |
|
102
|
|
|
|
|
|
|
require $graph_class_file.'.pm'; |
|
103
|
|
|
|
|
|
|
$self->graph_class->import; |
|
104
|
|
|
|
|
|
|
$self->graph_class->new( |
|
105
|
|
|
|
|
|
|
app_id => $self->app_id, |
|
106
|
|
|
|
|
|
|
secret => $self->secret, |
|
107
|
|
|
|
|
|
|
access_token => $self->access_token, |
|
108
|
|
|
|
|
|
|
); |
|
109
|
|
|
|
|
|
|
}, |
|
110
|
|
|
|
|
|
|
); |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
has rest_class => ( |
|
113
|
|
|
|
|
|
|
isa => 'Str', |
|
114
|
|
|
|
|
|
|
is => 'ro', |
|
115
|
|
|
|
|
|
|
required => 1, |
|
116
|
|
|
|
|
|
|
default => sub { 'WWW::Facebook::API' }, |
|
117
|
|
|
|
|
|
|
); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
has rest_api => ( |
|
120
|
|
|
|
|
|
|
is => 'ro', |
|
121
|
|
|
|
|
|
|
lazy => 1, |
|
122
|
|
|
|
|
|
|
default => sub { |
|
123
|
|
|
|
|
|
|
my $self = shift; |
|
124
|
|
|
|
|
|
|
my $rest_class_file = $self->rest_class; |
|
125
|
|
|
|
|
|
|
$rest_class_file =~ s/::/\//g; |
|
126
|
|
|
|
|
|
|
require $rest_class_file.'.pm'; |
|
127
|
|
|
|
|
|
|
$self->rest_class->import; |
|
128
|
|
|
|
|
|
|
$self->rest_class->new( |
|
129
|
|
|
|
|
|
|
desktop => $self->desktop ? 0 : 1, |
|
130
|
|
|
|
|
|
|
api_key => $self->api_key, |
|
131
|
|
|
|
|
|
|
secret => $self->secret, |
|
132
|
|
|
|
|
|
|
); |
|
133
|
|
|
|
|
|
|
}, |
|
134
|
|
|
|
|
|
|
); |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub graph { |
|
138
|
|
|
|
|
|
|
my ( $self ) = @_; |
|
139
|
|
|
|
|
|
|
$self->graph_api; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub rest { |
|
144
|
|
|
|
|
|
|
my ( $self ) = @_; |
|
145
|
|
|
|
|
|
|
$self->rest_api; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |
|
150
|
|
|
|
|
|
|
__END__ |
|
151
|
|
|
|
|
|
|
=pod |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 NAME |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Facebook - Facebook SDK in Perl |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 VERSION |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
version 0.102 |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
use Facebook; |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
my $fb = Facebook->new( |
|
166
|
|
|
|
|
|
|
app_id => $app_id, |
|
167
|
|
|
|
|
|
|
api_key => $api_key, |
|
168
|
|
|
|
|
|
|
secret => $secret, |
|
169
|
|
|
|
|
|
|
); |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
use Facebook::Signed; |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
my $logged_in_fb = Facebook->new( |
|
174
|
|
|
|
|
|
|
signed => Facebook::Signed->new( |
|
175
|
|
|
|
|
|
|
secret => $secret, |
|
176
|
|
|
|
|
|
|
facebook_data => $facebook_cookie_for_your_application_as_text, |
|
177
|
|
|
|
|
|
|
), |
|
178
|
|
|
|
|
|
|
app_id => $app_id, |
|
179
|
|
|
|
|
|
|
secret => $secret, |
|
180
|
|
|
|
|
|
|
api_key => $api_key, |
|
181
|
|
|
|
|
|
|
); |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# If you dont provide secret, it will try to fetch it from signed values |
|
184
|
|
|
|
|
|
|
my $shorter_logged_in_fb = Facebook->new( |
|
185
|
|
|
|
|
|
|
signed => Facebook::Signed->new( |
|
186
|
|
|
|
|
|
|
secret => $secret, |
|
187
|
|
|
|
|
|
|
facebook_data => $facebook_cookie_for_your_application_as_text, |
|
188
|
|
|
|
|
|
|
), |
|
189
|
|
|
|
|
|
|
app_id => $app_id, |
|
190
|
|
|
|
|
|
|
api_key => $api_key, |
|
191
|
|
|
|
|
|
|
); |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
# You need to have Facebook::Graph installed so that this works |
|
194
|
|
|
|
|
|
|
my $gettys_facebook_profile = $fb->graph->query |
|
195
|
|
|
|
|
|
|
->find(100001153174797) |
|
196
|
|
|
|
|
|
|
->include_metadata |
|
197
|
|
|
|
|
|
|
->request |
|
198
|
|
|
|
|
|
|
->as_hashref; |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
B<If you are new to Facebook application development in Perl please read L<Facebook::Manual>!> |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
This package reflects an instance for your application. Depending on what API of it you use, you require to install the |
|
205
|
|
|
|
|
|
|
needed distributions or provide alternative packages yourself. |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 METHODS |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head2 $obj->graph |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Arguments: None |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Return value: Object |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
B<If you want to use this, you need to install L<Facebook::Graph>!> |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Returns an instance of the graph_class (by default this is L<Facebook::Graph>) |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head2 $obj->rest |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Arguments: None |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Return value: Object |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
B<If you want to use this, you need to install L<WWW::Facebook::API>!> |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Returns an instance of the rest_class (by default this is L<WWW::Facebook::API>) |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=encoding utf8 |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head1 METHODS |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head1 LIMITATIONS |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head1 TROUBLESHOOTING |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 AUTHORS |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=over 4 |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=item * |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudssus.de> L<http://www.raudssus.de/> |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item * |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Frank Sheiness <syndesis@gmail.com> |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=back |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Raudssus Social Software & Facebook Distribution Authors. |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
256
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=cut |
|
259
|
|
|
|
|
|
|
|