line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#********************************************************************* |
2
|
|
|
|
|
|
|
#*** ResourcePool::Command::Exception |
3
|
|
|
|
|
|
|
#*** Copyright (c) 2002,2003 by Markus Winand |
4
|
|
|
|
|
|
|
#*** $Id: Exception.pm,v 1.7 2013-04-16 10:14:44 mws Exp $ |
5
|
|
|
|
|
|
|
#********************************************************************* |
6
|
|
|
|
|
|
|
package ResourcePool::Command::Exception; |
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
506
|
use vars qw($VERSION); |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
3800
|
|
9
|
|
|
|
|
|
|
#use overload ('""' => 'stringify'); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = "1.0107"; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new($$$$) { |
14
|
14
|
|
|
14
|
0
|
33
|
my $proto = shift; |
15
|
14
|
|
|
|
|
22
|
my $origexception = shift; |
16
|
14
|
|
|
|
|
19
|
my $command = shift; |
17
|
14
|
|
|
|
|
19
|
my $executions = shift; |
18
|
14
|
|
33
|
|
|
61
|
my $class = ref($proto) || $proto; |
19
|
14
|
|
|
|
|
23
|
my $self = {}; |
20
|
14
|
|
|
|
|
43
|
bless($self, $class); |
21
|
14
|
|
|
|
|
34
|
$self->_setException($origexception); |
22
|
14
|
|
|
|
|
29
|
$self->_setCommand($command); |
23
|
14
|
|
|
|
|
34
|
$self->_setExecutions($executions); |
24
|
|
|
|
|
|
|
|
25
|
14
|
|
|
|
|
65
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _setCommand($$) { |
29
|
14
|
|
|
14
|
|
21
|
my ($self, $command) = @_; |
30
|
14
|
|
|
|
|
27
|
$self->{command} = $command; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub getCommand($) { |
34
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
35
|
0
|
|
|
|
|
0
|
return $self->{command}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _setExecutions($$) { |
39
|
14
|
|
|
14
|
|
21
|
my ($self, $executions) = @_; |
40
|
14
|
|
|
|
|
25
|
$self->{executions} = $executions; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub getExecutions($$) { |
44
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
45
|
0
|
|
|
|
|
0
|
return $self->{executions}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _setException($$) { |
49
|
14
|
|
|
14
|
|
19
|
my ($self, $exception) = @_; |
50
|
14
|
|
|
|
|
52
|
$self->{exception} = $exception; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub getException($) { |
54
|
4
|
|
|
4
|
0
|
176
|
my ($self) = @_; |
55
|
4
|
|
|
|
|
23
|
return $self->{exception}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub rootException($) { |
59
|
22
|
|
|
22
|
1
|
1603
|
my ($self) = @_; |
60
|
22
|
|
|
|
|
28
|
my $rv; |
61
|
22
|
|
|
|
|
32
|
eval { |
62
|
22
|
|
|
|
|
234
|
$rv = $self->{exception}->rootException(); |
63
|
|
|
|
|
|
|
}; |
64
|
22
|
100
|
|
|
|
58
|
if (!$@) { |
65
|
5
|
|
|
|
|
24
|
return $rv; |
66
|
|
|
|
|
|
|
} else { |
67
|
17
|
|
|
|
|
78
|
return $self->{exception}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub stringify($) { |
72
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
73
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self; |
74
|
0
|
|
|
|
|
|
return $class . ': failed with "' |
75
|
|
|
|
|
|
|
. $self->rootException() |
76
|
|
|
|
|
|
|
. '" while executing "' |
77
|
|
|
|
|
|
|
. $self->getCommand() |
78
|
|
|
|
|
|
|
. '"'; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |