Plagger/Plugin/Notify/Growl.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
register
2.0
initialize
2.0
entry
2.0
CRAP 2.0
1 package Plagger::Plugin::Notify::Growl;
2 use strict;
3 use base qw( Plagger::Plugin );
4  
5 use Encode;
6 use Mac::Growl ':all';
7  
8 sub register {
9 my($self, $context) = @_;
10  
11 $context->register_hook(
12 $self,
13 'publish.init' => \&initialize,
14 'publish.entry' => \&entry,
15 );
16 }
17  
18 sub initialize {
19 my ($self, $context) = @_;
20 my @updates;
21 for my $update ($context->update->feeds){
22 push @updates, encode_utf8($update->title_text);
23 }
24 Mac::Growl::RegisterNotifications("plagger", [@updates],[@updates]);
25 }
26  
27 sub entry {
28 my($self, $context, $args) = @_;
29 Mac::Growl::PostNotification(
30 "plagger",
31 encode_utf8($args->{feed}->title_text),
32 encode_utf8($args->{entry}->title_text),
33 encode_utf8($args->{entry}->body_text)
34 );
35 }
36  
37 1;
38  
39