The sample was not quite right. The sub "dave" is a generic sub which calls a procedure with DBD::Oracle. The call to "dave" in the example does fail but what is missing from the example is that the catch also may call "dave" but with a different procedure name. This is closer:
use Try::Tiny;
use Log::Log4perl qw(get_logger :levels);
Log::Log4perl->init_and_watch('/etc/log4.conf', 60);
my $log = get_logger('Q::S');
fred();
sub fred
{
my $x = try {
# dave dies in the cases we get the panic
dave('proc1', {}, 'arg1', 'arg2');
0;
} catch {
my $ev = $_;
if ($sometimes) { # sometimes goes this path and sometimes the
+ else
eval {
dave('proc2', {}, 'arg1', 'arg2');
1;
} or $log->warn("failed $@");
} else {
$log->logwarn("test $_");
}
1;
};
print "$x\n";
return if $x; # <---- this would be q.pl line 1895
}
sub dave
{
# the following line would be DB.pm line 1380
my ($sth, $options, @args) = @_;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|