I applaud the use of "use warnings" in modules but I have a problem
with warnings emerging from Log::Log4perl::Layout::PatternLayout. I
have an application which uses $SIG{__DIE__} to catch exceptions and
route them to appenders. I often find I get a stack of messages which
contains:
Use of uninitialized value in concatenation (.) or string at
/opt/perl/lib/site_perl/5.6.1/Log/Log4perl/Layout/PatternLayout.pm line 194.
And since I have $SIG{__WARN__} set to do the same thing as for
exceptions, I tend to get cascading. (Yes, I do have to catch and
report warnings.)
Not sure whether $^W takes precedence over the "use warnings" in
PatternLayout.pm so maybe I could undef it around the code that's
producing this uninit warning, but that's pretty kludgey. In my
version of that module the line in question is
# For the name of the subroutine the logger was triggered,
# we need to go one more level up
$subroutine = (caller($caller_level+1))[3];
$subroutine = "main::" unless $subroutine;
$info{M} = $subroutine;
$info{l} = "$subroutine $filename ($line)"; # <--- ***
Odd that one of those things would be undefined but this may be
happening during global destruction.
Absent patching PatternLayout.pm to ensure there are no undef values in
that statement, any other suggestions?
--
Peter Scott
Pacific Systems Design Technologies
|