line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Backup::Omni::Base; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
|
|
|
|
|
|
our $EXCEPTION = 'Backup::Omni::Exception'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
44766
|
use Backup::Omni::Exception; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
17
|
|
7
|
1
|
|
|
1
|
|
3212
|
use Params::Validate ':all'; |
|
1
|
|
|
|
|
15517
|
|
|
1
|
|
|
|
|
257
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Backup::Omni::Class |
10
|
1
|
|
|
|
|
15
|
base => 'Backup::Omni Badger::Base', |
11
|
|
|
|
|
|
|
version => $VERSION, |
12
|
|
|
|
|
|
|
messages => { |
13
|
|
|
|
|
|
|
noresults => 'unable to find any results for %s', |
14
|
|
|
|
|
|
|
nosession => 'no session data found for %s on %s', |
15
|
|
|
|
|
|
|
baddate => 'unable to perform date parsing, reason: %s', |
16
|
|
|
|
|
|
|
badtemp => 'bad temporary session id', |
17
|
|
|
|
|
|
|
badparams => 'invalid parameters passed from %s at line %s', |
18
|
|
|
|
|
|
|
invparams => 'invalid paramters passed, reason: %s', |
19
|
|
|
|
|
|
|
nosubmit => 'unable to submit a restore for %s', |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
vars => { |
22
|
|
|
|
|
|
|
PARAMS => {} |
23
|
|
|
|
|
|
|
} |
24
|
1
|
|
|
1
|
|
499
|
; |
|
1
|
|
|
|
|
3
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
27
|
|
|
|
|
|
|
# Public Methods |
28
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub config { |
31
|
0
|
|
|
0
|
1
|
|
my ($class, $p) = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return $class->{config}->{$p}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub validation_exception { |
38
|
0
|
|
|
0
|
1
|
|
my $param = shift; |
39
|
0
|
|
|
|
|
|
my $class = shift; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $x = index($param, $class); |
42
|
0
|
|
|
|
|
|
my $y = index($param, ' ', $x); |
43
|
0
|
|
|
|
|
|
my $method; |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
if ($y > 0) { |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $l = $y - $x; |
48
|
0
|
|
|
|
|
|
$method = substr($param, $x, $l); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} else { |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
$method = substr($param, $x); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
chomp($method); |
57
|
0
|
|
|
|
|
|
$method =~ s/::/./g; |
58
|
0
|
|
|
|
|
|
$method = lc($method) . '.invparams'; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$class->throw_msg($method, 'invparams', $param); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
65
|
|
|
|
|
|
|
# Private Methods |
66
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub init { |
69
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $params = $self->class->hash_vars('PARAMS'); |
72
|
0
|
|
|
|
|
|
my %p = validate(@_, $params); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$self->{config} = \%p; |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
1
|
|
3860
|
no strict "refs"; # to register new methods in package |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
77
|
1
|
|
|
1
|
|
6
|
no warnings; # turn off warnings |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
138
|
|
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
while (my ($key, $value) = each(%p)) { |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
$key =~ s/^-//; |
82
|
0
|
|
|
|
|
|
$self->{$key} = $value; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
*$key = sub { |
85
|
0
|
|
|
0
|
|
|
my $self = shift; |
86
|
0
|
|
|
|
|
|
return $self->{$key}; |
87
|
0
|
|
|
|
|
|
}; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $self; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |