line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XAS::Apps::Alert; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use XAS::Class |
6
|
1
|
|
|
|
|
5
|
debug => 0, |
7
|
|
|
|
|
|
|
version => $VERSION, |
8
|
|
|
|
|
|
|
base => 'XAS::Lib::App', |
9
|
|
|
|
|
|
|
utils => 'dotid', |
10
|
|
|
|
|
|
|
accessors => 'message', |
11
|
1
|
|
|
1
|
|
769
|
; |
|
1
|
|
|
|
|
2
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
# Public Methods |
15
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub main { |
18
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self->alert->send($self->message); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub options { |
25
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
return { |
28
|
|
|
|
|
|
|
'script=s' => sub { |
29
|
0
|
|
|
0
|
|
|
$self->env->script($_[1]); |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
36
|
|
|
|
|
|
|
# Private Methods |
37
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub init { |
40
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $self = $class->SUPER::init(@_); |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
unless (defined($ARGV[0])) { |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$self->throw_msg( |
47
|
|
|
|
|
|
|
dotid($self->class) . '.nomessage', |
48
|
|
|
|
|
|
|
'nomessage', |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$self->{'message'} = $ARGV[0]; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return $self; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
XAS::Apps::Alert - A class for the XAS environment |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SYNOPSIS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
use XAS::Apps::Alert; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $app = XAS::Apps::Alert->new( |
72
|
|
|
|
|
|
|
-throws => 'xas-alert' |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
exit $app->run; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This module is used to send an alert from the command line. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 METHODS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 main |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This method will start the processing. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 options |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This module provides these additonal cli options. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=over 4 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item B<--script> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This provides a name for the script. Default is 'xas-alert'. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SEE ALSO |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over 4 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item L<XAS|XAS> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Copyright (c) 2012-2015 Kevin L. Esteb |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the terms of the Artistic License 2.0. For details, see the full text |
117
|
|
|
|
|
|
|
of the license at http://www.perlfoundation.org/artistic_license_2_0. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |