line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Jaipo::Notify; |
2
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
47
|
|
3
|
2
|
|
|
2
|
|
6
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
31
|
|
4
|
2
|
|
|
2
|
|
6
|
use base qw/Class::Accessor::Fast/; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
411
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors (qw/notifier/); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
1
|
|
|
1
|
1
|
1
|
my $class = shift; |
9
|
1
|
|
|
|
|
1
|
my $arg = shift; # should be "1" or the module name "Jaipo::Notify::SomeNotify::Module" |
10
|
1
|
|
|
|
|
1
|
my $self = {}; |
11
|
1
|
|
|
|
|
2
|
bless $self , $class; |
12
|
1
|
|
|
|
|
2
|
$self->init($arg); |
13
|
0
|
|
|
|
|
0
|
return $self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
1
|
|
|
1
|
0
|
1
|
my $self = shift; |
18
|
1
|
|
|
|
|
1
|
my $notify_module = shift; |
19
|
1
|
|
|
|
|
2
|
$self->notifier( {} ); |
20
|
|
|
|
|
|
|
|
21
|
1
|
50
|
|
|
|
14
|
if ( not $notify_module ) { # use default notify module |
22
|
1
|
50
|
|
|
|
5
|
if( $^O =~ m/linux/i ) { |
|
|
0
|
|
|
|
|
|
23
|
1
|
|
|
|
|
2
|
$notify_module = "Jaipo::Notify::LibNotify"; |
24
|
|
|
|
|
|
|
} elsif ( $^O =~ m/darwin/i ) { |
25
|
0
|
|
|
|
|
0
|
$notify_module = "Jaipo::Notify::MacGrwol"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
47
|
eval "require $notify_module"; |
30
|
1
|
|
|
|
|
368
|
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
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
39
|
0
|
|
|
|
|
|
$self->notifier->yell( $args->{message} ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |