Subject: | NDC/MDC not very practicial, request for enhancement |
There should be a way to use auto-destruction for removing NDC/MDC
keys/values.
Example:
for ( my $i = 0; $i < 10; $i++ ) {
my $a = Log::Log4perl::NDC->push(sprintf('i=%d',$i));
... do something with i ...
# automatically remove NDC for i when $a goes out of lexical scope
}
This comes handy whenever the use case is not so simple. The way it is
now, one has to take considerable precaution to avoid spamming the
NDC/MDC (ie. remove it before every single return statement or the like).