I have some code with an anonymous sub that uses __ANON__ to set the sub
name in logging and error messages (a semi-documented trick) like:

        sub {
            local *__ANON__ = "subname"; # name the anon sub
            [...]

            warn *__ANON__,": ...\n";

The problem comes about with the warn call that wants to reference
__ANON__. If __ANON__ is used by itself, it produces a bareword warning.
If it is used as a glob (either *__ANON__ or *{__ANON__}), it works, but
produces output prefixed with "*", which seems to suggest it isn't
really being interpreted as a glob.

While the real code is going to end up using a Log::Log4perl method
instead of warn (which internally uses caller()), making this moot, I'm
curious to know what the correct syntax is here.

 -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to