Plagger/Plugin/Subscription/PlanetINI.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 38 CC 2 SCAR 11.0
CC
2
Cov
0%
load
6.0
register
2.0
BEGIN
2.0
CRAP 3.0
1 package Plagger::Plugin::Subscription::PlanetINI;
2 use strict;
3 use base qw( Plagger::Plugin );
4  
5 use Config::INI::Simple;
6 use Plagger::Util;
7 use URI;
8  
9 sub register {
10 my($self, $context) = @_;
11  
12 $context->register_hook(
13 $self,
14 'subscription.load' => \&load,
15 );
16 }
17  
18 sub load {
19 my($self, $context) = @_;
20  
21 my $config = Config::INI::Simple->new;
22 $config->read($self->conf->{path});
23  
24 for my $url (keys %$config) {
25 next if $url !~ m!https?://!;
26  
27 my $feed = Plagger::Feed->new;
28 $feed->url($url);
29 $feed->title($config->{$url}->{name});
30  
31 $context->subscription->add($feed);
32 }
33 }
34  
35 1;
36  
37 __END__