line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Jaipo::Notify; |
2
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
101
|
|
3
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
61
|
|
4
|
3
|
|
|
3
|
|
11
|
use base qw/Class::Accessor::Fast/; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
660
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors (qw/notifier/); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
1
|
|
|
1
|
1
|
2
|
my $class = shift; |
9
|
1
|
|
|
|
|
2
|
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
|
|
|
|
|
3
|
$self->init($arg); |
13
|
0
|
|
|
|
|
0
|
return $self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
18
|
1
|
|
|
|
|
0
|
my $notify_module = shift; |
19
|
1
|
|
|
|
|
6
|
$self->notifier( {} ); |
20
|
|
|
|
|
|
|
|
21
|
1
|
50
|
|
|
|
17
|
if ( not $notify_module ) { # use default notify module |
22
|
1
|
50
|
|
|
|
7
|
if( $^O =~ m/linux/i ) { |
|
|
0
|
|
|
|
|
|
23
|
1
|
|
|
|
|
1
|
$notify_module = "Jaipo::Notify::LibNotify"; |
24
|
|
|
|
|
|
|
} elsif ( $^O =~ m/darwin/i ) { |
25
|
0
|
|
|
|
|
0
|
$notify_module = "Jaipo::Notify::MacGrwol"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
55
|
eval "require $notify_module"; |
30
|
1
|
|
|
|
|
433
|
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; |