root/lang/perl/plagger/lib/Plagger/Plugin/Subscription/Me.pm

Revision 7781, 1.0 kB (checked in by youpy, 9 months ago)

added plagger plugin: Subscription::Me

Line 
1package Plagger::Plugin::Subscription::Me;
2use strict;
3use base qw( Plagger::Plugin );
4
5use Net::SocialGraph;
6
7sub register {
8    my($self, $context) = @_;
9
10    $context->register_hook(
11        $self,
12        'subscription.load' => $self->can('load'),
13    );
14}
15
16sub load {
17    my($self, $context) = @_;
18
19
20    my $sg  = Net::SocialGraph->new(fme => 1);
21    my $res = $sg->get($self->conf->{url});
22
23    for my $node (keys(%{$res->{nodes}})) {
24        my $feed = Plagger::Feed->new;
25        $feed->url($node);
26        Plagger->context->subscription->add($feed);
27    }
28}
29
301;
31
32__END__
33
34=head1 NAME
35
36Plagger::Plugin::Subscription::Me - Subscription list with Social Graph
37
38=head1 SYNOPSIS
39
40  - module: Subscription::Me
41    config:
42      url: http://example.com/users/foo
43
44=head1 DESCRIPTION
45
46This plugin creates Subscription by fetching "me" links using Google
47Social Graph API.
48
49=head1 AUTHOR
50
51youpy
52
53=head1 SEE ALSO
54
55L<Plagger>, L<http://code.google.com/apis/socialgraph/>
56
57=cut
Note: See TracBrowser for help on using the browser.