Jaipo/Notify.pm

filter: Statementstmt 80.0% 24 / 30 Branchbran 33.3% 2 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 33.3% 1 / 3 totaltotal 71.1% 32 / 45 CC 4 SCAR 10.8
CC
4
Cov
72%
init
5.1
create
2.0
new
1.0
CRAP 2.9
« Jaipo/Config.pm ↑ Summary Jaipo/Logger.pm »
1 package Jaipo::Notify;
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base qw/Class::Accessor::Fast/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 __PACKAGE__->mk_accessors (qw/notifier/);
6  
7 sub new {
8 1 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
9 1 my $arg = shift; # should be "1" or the module name "Jaipo::Notify::SomeNotify::Module"
10 1 my $self = {};
11 1 bless $self , $class;
12 1 $self->init($arg);
13 0 return $self;
14 }
15  
16 sub init {
17 1 ▶ my $self = shift;
Subroutine init: called CC=4 SCAR=16.3
Pod undocumented
18 1 my $notify_module = shift;
19 1 $self->notifier( {} );
20  
21 1 ▶ if ( not $notify_module ) { # use default notify module
Branch: 1 branch
BranchTrueFalseTotal
unless ($notify_module) 1 0 1
22 1 ▶ if( $^O =~ m/linux/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($^O =~ /linux/i) { } 1 0 1
elsif ($^O =~ /darwin/i) { } 0 0 0
23 1 $notify_module = "Jaipo::Notify::LibNotify";
24 } elsif ( $^O =~ m/darwin/i ) {
25 0 $notify_module = "Jaipo::Notify::MacGrwol";
26 }
27 }
28  
29 1 eval "require $notify_module";
30 1 my $notify = $notify_module->new;
31  
32 # save notify object to accessor
33 0 $self->notifier( $notify );
34 0 print "$notify_module Notifier Initialized\n";
35 }
36  
37 sub create {
38 0 ▶ my ( $self, $args ) = @_;
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
39 0 $self->notifier->yell( $args->{message} );
40 }
41  
42 2 1;
« Jaipo/Config.pm ↑ Summary Jaipo/Logger.pm »