| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::Maisha::Plugin::PingFM; |
|
2
|
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
205501
|
use strict; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
204
|
|
|
4
|
5
|
|
|
5
|
|
28
|
use warnings; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
401
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
|
9
|
|
|
|
|
|
|
# Library Modules |
|
10
|
|
|
|
|
|
|
|
|
11
|
5
|
|
|
5
|
|
27
|
use base qw(App::Maisha::Plugin::Base); |
|
|
5
|
|
|
|
|
14
|
|
|
|
5
|
|
|
|
|
8889
|
|
|
12
|
|
|
|
|
|
|
use base qw(Class::Accessor::Fast); |
|
13
|
|
|
|
|
|
|
use Net::PingFM; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
|
16
|
|
|
|
|
|
|
# Accessors |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors($_) for qw(api); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
|
21
|
|
|
|
|
|
|
# Public API |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub login { |
|
24
|
|
|
|
|
|
|
my ($self,$user,$pass) = @_; |
|
25
|
|
|
|
|
|
|
my $api; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
eval { |
|
28
|
|
|
|
|
|
|
$api = Net::PingFM->new( |
|
29
|
|
|
|
|
|
|
user_key => $user, |
|
30
|
|
|
|
|
|
|
api_key => $pass, |
|
31
|
|
|
|
|
|
|
source => $self->{source}, |
|
32
|
|
|
|
|
|
|
useragent => $self->{useragent}, |
|
33
|
|
|
|
|
|
|
clientname => $self->{clientname}, |
|
34
|
|
|
|
|
|
|
clientver => $self->{clientver}, |
|
35
|
|
|
|
|
|
|
clienturl => $self->{clienturl} |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
}; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
unless($api) { |
|
40
|
|
|
|
|
|
|
warn "Unable to establish connection to PingFM API\n"; |
|
41
|
|
|
|
|
|
|
return 0; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$self->api($api); |
|
45
|
|
|
|
|
|
|
return 1; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub api_update { |
|
49
|
|
|
|
|
|
|
my $self = shift; |
|
50
|
|
|
|
|
|
|
my $text = join(' ',@_); |
|
51
|
|
|
|
|
|
|
$self->api->post($text, {post_method => 'status'}); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
App::Maisha::Plugin::PingFM - Maisha interface to ping.fm |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
maisha |
|
65
|
|
|
|
|
|
|
maisha> use PingFM |
|
66
|
|
|
|
|
|
|
use ok |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
App::Maisha::Plugin::PingFM is the gateway for Maisha to access the ping.fm |
|
71
|
|
|
|
|
|
|
API. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 Constructor |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 4 |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * new |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=back |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 Process Methods |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=over 4 |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * login |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Login to the service. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=back |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 API Methods |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The API methods are used to interface to with the ping.fm API. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over 4 |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * api_update |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=back |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
ping.fm provides a default service to post to othjer services, thus in this |
|
104
|
|
|
|
|
|
|
instance only the update method is available. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 BUGS, PATCHES & FIXES |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
There are no known bugs at the time of this release. However, if you spot a |
|
109
|
|
|
|
|
|
|
bug or are experiencing difficulties that are not explained within the POD |
|
110
|
|
|
|
|
|
|
documentation, please submit a bug to the RT system (see link below). However, |
|
111
|
|
|
|
|
|
|
it would help greatly if you are able to pinpoint problems or even supply a |
|
112
|
|
|
|
|
|
|
patch. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Fixes are dependent upon their severity and my availability. Should a fix not |
|
115
|
|
|
|
|
|
|
be forthcoming, please feel free to (politely) remind me by sending an email |
|
116
|
|
|
|
|
|
|
to barbie@cpan.org . |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
RT: http://rt.cpan.org/Public/Dist/Display.html?Name=App-Maisha-Plugin-PingFM |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
For further information regarding the commands and configuration, please see |
|
123
|
|
|
|
|
|
|
the 'maisha' script included with this distribution. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L<App::Maisha> - http://maisha.grango.org |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
L<Net::PingFM> |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 THANKS TO |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Robert Rothenberg for giving me the idea to write this plugin in the first |
|
132
|
|
|
|
|
|
|
place. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Barbie, <barbie@cpan.org> |
|
137
|
|
|
|
|
|
|
for Miss Barbell Productions <http://www.missbarbell.co.uk>. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Copyright (C) 2009-2012 by Barbie |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This distribution is free software; you can redistribute it and/or |
|
144
|
|
|
|
|
|
|
modify it under the Artistic License v2. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |