Plagger/Plugin/Publish/FOAFRoll.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 42 CC 1 SCAR 6.9
CC
1
Cov
0%
init
2.0
register
2.0
finalize
2.0
CRAP 2.0
1 package Plagger::Plugin::Publish::FOAFRoll;
2 use strict;
3 use base qw( Plagger::Plugin );
4  
5 use File::Spec;
6  
7 sub init {
8 my $self = shift;
9 $self->SUPER::init(@_);
10 my $output = $self->conf->{filename}
11 or Plagger->context->error("filename is missing");
12 }
13  
14 sub register {
15 my($self, $context) = @_;
16 $context->register_hook(
17 $self,
18 'publish.finalize' => \&finalize,
19 );
20 }
21  
22 sub finalize {
23 my($self, $context, $args) = @_;
24  
25 my $out = $self->templatize('foafroll.tt', {
26 feeds => [ $context->subscription->feeds ],
27 conf => $self->conf,
28 });
29  
30 my $path = $self->conf->{filename};
31 $context->log(info => "Writing FOAFRoll to $path");
32  
33 open my $fh, ">:utf8", $path or $context->error("$path: $!");
34 print $fh $out;
35 close $fh;
36 }
37  
38 1;
39  
40 __END__