Plagger/Plugin/Notify/Beep.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 35 CC 4 SCAR 18.3
CC
4
Cov
0%
finalize
12.0
update
6.0
register
2.0
CRAP 6.2
1 package Plagger::Plugin::Notify::Beep;
2 use strict;
3 use base qw( Plagger::Plugin );
4  
5 use Audio::Beep;
6  
7 sub register {
8 my($self, $context) = @_;
9 $context->register_hook(
10 $self,
11 'publish.feed' => \&update,
12 'publish.finalize' => \&finalize,
13 );
14 $self->{count} = 0;
15 }
16  
17 sub update {
18 my($self, $context, $args) = @_;
19 $self->{count}++ if $args->{feed}->count;
20 }
21  
22 sub finalize {
23 my($self, $context, $args) = @_;
24 if ($self->{count}) {
25 if ($self->conf->{music}) {
26 Audio::Beep->new->play($self->conf->{music});
27 } else {
28 Audio::Beep::beep;
29 }
30 }
31 }
32  
33 1;
34  
35 __END__