blob: 842045f6a188b65d170fc61c1e698f64b2fb518b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
--- ./lib/Config/Objective.pm.sav Wed Apr 6 19:24:00 2005
+++ ./lib/Config/Objective.pm Wed Apr 6 19:31:48 2005
@@ -91,17 +91,21 @@
$method = 'default'
if (!defined($method));
- $retval = eval { $self->{'objs'}->{$obj}->$method(@args); };
- if ($@)
+ #
+ # Trap and extend die and warn so we can tell the user where
+ # we were when the signals were generated.
+ #
+ if (@{$self->{'lexer_stack'}})
{
- if (@{$self->{'lexer_stack'}})
- {
- $line = $self->{'lexer_stack'}->[-1]->line;
- $msg = "$self->{'file_stack'}->[-1]:$line: ";
- }
- $msg .= "$obj";
- die "$msg: $@";
+ $line = $self->{'lexer_stack'}->[-1]->line;
+ $msg = "$self->{'file_stack'}->[-1]: line $line: ";
}
+ $msg .= $obj;
+
+ local $SIG{__DIE__} = sub { die "$msg: $_[0]"; };
+ local $SIG{__WARN__} = sub { warn "$msg: $_[0]"; };
+
+ $retval = $self->{'objs'}->{$obj}->$method(@args);
# print "<== _call_obj_method(): returning '"
# . (defined($retval) ? $retval : 'undef') . "'\n";
|