Plagger/Plugin/Namespace/HatenaFotolife.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 32 CC 3 SCAR 19.5
CC
3
Cov
0%
handle
12.0
register
2.0
BEGIN
2.0
CRAP 7.0
1 package Plagger::Plugin::Namespace::HatenaFotolife;
2 use strict;
3 use base qw( Plagger::Plugin );
4  
5 sub register {
6 my($self, $context) = @_;
7 $context->register_hook(
8 $self,
9 'aggregator.entry.fixup' => \&handle,
10 );
11 }
12  
13 sub handle {
14 my($self, $context, $args) = @_;
15  
16 # Hatena Image extensions
17 my $hatena = $args->{orig_entry}->{entry}->{"http://www.hatena.ne.jp/info/xmlns#"} || {};
18 if ($hatena->{imageurl}) {
19 my $enclosure = Plagger::Enclosure->new;
20 $enclosure->url($hatena->{imageurl});
21 $enclosure->auto_set_type;
22 $args->{entry}->add_enclosure($enclosure);
23 }
24  
25 if ($hatena->{imageurlsmall}) {
26 $args->{entry}->icon({ url => $hatena->{imageurlsmall} });
27 }
28  
29 1;
30 }
31  
32 1;
33 __END__