root/trunk/plagger/lib/Plagger/Plugin/Notify/UpdatePing.pm

Revision 797 (checked in by miyagawa, 14 years ago)

new plugin Notify::UpdatePing? and test suite.

Line 
1 package Plagger::Plugin::Notify::UpdatePing;
2 use strict;
3 use base qw( Plagger::Plugin );
4
5 use XMLRPC::Lite;
6
7 sub register {
8     my($self, $context) = @_;
9     $context->register_hook(
10         $self,
11         'publish.feed' => \&feed,
12     );
13 }
14
15 sub feed {
16     my($self, $context, $args) = @_;
17
18     my $feed = $args->{feed};
19
20     my $urls = $self->conf->{url};
21     $urls = [ $urls ] unless ref $urls;
22
23     my @args = (XMLRPC::Data->type(string => $feed->title), $feed->link);
24
25     for my $url (@$urls) {
26         $context->log(info => "Ping " . $feed->link . " to $url");
27         XMLRPC::Lite->new->proxy($url)->call('weblogUpdates.ping', @args);
28     }
29 }
30
31 1;
32
33 __END__
34
35 =head1 NAME
36
37 Plagger::Plugin::Notify::UpdatePing - Notify updates via XMLRPC update ping
38
39 =head1 SYNOPSIS
40
41   - module: Notify::UpdatePing
42     config:
43       url: http://www.bloglines.com/ping
44
45 =head1 DESCRIPTION
46
47 This plugin notifies feed updates to update ping servers using XML-RPC.
48
49 =head1 AUTHOR
50
51 Tatsuhiko Miyagawa
52
53 =head1 SEE ALSO
54
55 L<Plagger>, L<XMLRPC::Lite>
56
57 =cut
Note: See TracBrowser for help on using the browser.