From: Kevin G. <ke...@go...> - 2004-05-30 06:14:11
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mike, thanks for doing all that work, fantastic stuff except for two points: I think the circular reference thing is a red herring, although I agree with the approach in your patch, and you need a local($?) in your END block: First, did you actually track down the circular reference the Logger.pm mentioned? Maybe I'm being dense (probably) but I don't see it in the dump you sent. I checked out a basic $logger under use Test::Memory::Cycle and didn't see any circular references. Are you sure Tim's exit value problem is related to circular references? ~ It seems to me that since we're using package variables to store our loggers, they're not going to be destroyed until the Global Destruction phase of the script, the reference in the package symbol table won't go away until then. That behavior seems correct to me. So the Mail appender's DESTROY is being called during the Global Destruction phase and overwriting $?. Maybe what we need to do is "local($?)" before then--if we can localize $? in the call stack above where the flush() happens then the correct value will be restored after the flush completes, right? To do that we need to do the flushing before the GDP kicks in, so your END block in Log4perl.pm and your cleanup() methods are the right idea. ~ However, your (Mike's) example sets $? in that BEGIN block, but doesn't help Tim's code, his $? isn't from a BEGIN block. However, if you change END { Log::Log4perl::Logger::cleanup(); } to END { local($?); Log::Log4perl::Logger::cleanup(); } Then Tim's code does finish with the proper exit strategy. How does that sound? Let me know if you don't follow me, in fact feel free to phone me if I'm not clear, I'm around all weekend (during normal waking hours, that is). - -- Happy Trails. . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510)525-5217 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org iD8DBQFAuXpo4g4/Tl71vUkRAu2TAKCsPxT+OYfia+YGTjA901ZVEiZBjwCgt/rc p6wF9m73KF/VwP+oX27dIEk= =Mdad -----END PGP SIGNATURE----- |