line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Backup::Omni::Session::Messages; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1356
|
use Params::Validate ':all'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
298
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Backup::Omni::Class |
8
|
1
|
|
|
|
|
15
|
version => $VERSION, |
9
|
|
|
|
|
|
|
base => 'Backup::Omni::Base', |
10
|
|
|
|
|
|
|
constants => 'OMNIDB', |
11
|
|
|
|
|
|
|
mutators => 'cur_pos', |
12
|
|
|
|
|
|
|
constant => { |
13
|
|
|
|
|
|
|
COMMAND => '%s -session %s -report %s', |
14
|
|
|
|
|
|
|
}, |
15
|
|
|
|
|
|
|
vars => { |
16
|
|
|
|
|
|
|
PARAMS => { |
17
|
|
|
|
|
|
|
-session => 1, |
18
|
|
|
|
|
|
|
-report => { optional => 1, default => ' ', regex => qr/warning|minor|major|critical|\w/ }, |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
1
|
|
|
1
|
|
6
|
; |
|
1
|
|
|
|
|
2
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Params::Validate::validation_options( |
24
|
|
|
|
|
|
|
on_fail => sub { |
25
|
|
|
|
|
|
|
my $params = shift; |
26
|
|
|
|
|
|
|
my $class = __PACKAGE__; |
27
|
|
|
|
|
|
|
Backup::Omni::Base::validation_exception($params, $class); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
3365
|
use Data::Dumper; |
|
1
|
|
|
|
|
10897
|
|
|
1
|
|
|
|
|
613
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
34
|
|
|
|
|
|
|
# Public Methods |
35
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub all { |
38
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return $self->{results}; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub next { |
45
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $pos = $self->cur_pos; |
48
|
0
|
|
|
|
|
|
my $end = scalar(@{$self->{results}}) - 1; |
|
0
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
$pos++; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if ($pos <= $end) { |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->cur_pos($pos); |
55
|
0
|
|
|
|
|
|
return $self->{results}->[$pos]; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} else { |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$self->cur_pos($pos); |
60
|
0
|
|
|
|
|
|
return undef; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub prev { |
67
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $pos = $self->cur_pos; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
$pos--; |
72
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
if ($pos < 0) { |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
$self->cur_pos(0); |
76
|
0
|
|
|
|
|
|
return undef; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} else { |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$self->cur_pos($pos); |
81
|
0
|
|
|
|
|
|
return $self->{results}->[$pos]; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub first { |
88
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
$self->cur_pos(0); |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
return $self->{results}->[0]; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub last { |
97
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $end = scalar(@{$self->{results}}) - 1; |
|
0
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
$self->cur_pos($end); |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return $self->{results}->[$end]; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
108
|
|
|
|
|
|
|
# Private Methods |
109
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub init { |
112
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $self = $class->SUPER::init(@_); |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
my $command = sprintf(COMMAND, OMNIDB, $self->session, $self->report); |
117
|
0
|
|
|
|
|
|
my @result = `$command`; |
118
|
0
|
|
|
|
|
|
my $rc = $?; |
119
|
|
|
|
|
|
|
|
120
|
0
|
0
|
|
|
|
|
unless (grep(/Normal/, @result)) { |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
$self->throw_msg( |
123
|
|
|
|
|
|
|
'backup.omni.session.messages', |
124
|
|
|
|
|
|
|
'noresults', |
125
|
|
|
|
|
|
|
$self->session |
126
|
|
|
|
|
|
|
); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
$self->{cur_pos} = 0; |
131
|
0
|
|
|
|
|
|
$self->{results} = \@result; |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
return $self; |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |