For the curious, there is a way to make this work the "expected" way:
First, I read this here: http://www.perlmonks.org/?node_id=304883 And some playing around led me to this: perl -Mstrict -w -e 'package foo; use Carp qw(cluck); sub { *__ANON__="sub_name"; cluck "WARN ${\*__ANON__}: wharrrgarbl"}->()' Which should illuminate some of what's going on for the curious. On Thu, Jun 17, 2010 at 1:39 AM, Tom Metro <tmetro-boston...@vl.com> wrote: > Ben Tilly wrote: >> Tom Metro wrote: >>> sub { >>> local *__ANON__ = "subname"; # name the anon sub >> >> Rather than a semi-documented trick, I'd recommend the clearly >> documented Sub::Name module for this. > > Agreed. I just ran across Sub::Name yesterday when I was trying to dig > up more info on the syntax for using __ANON__. > > I've since updated the code to use Sub::Name. It really is functionality > that should be built-in to the sub statement. > > >>> If it is used as a glob...it works, but >>> produces output prefixed with "*"... >> >> The * prefix just indicates that >> it is being interpreted as some other glob, but if you look at the >> output the glob it appears as should be what you were trying to name >> it. > > I'm not following. It feels like either the "*" should be consumed by > the tokenizer as part of the variable, or treated as extraneous junk and > either passed to the statement/function, or trigger a syntax error. > > -Tom > > -- > Tom Metro > Venture Logic, Newton, MA, USA > "Enterprise solutions through open source." > Professional Profile: http://tmetro.venturelogic.com/ > > _______________________________________________ > Boston-pm mailing list > Boston-pm@mail.pm.org > http://mail.pm.org/mailman/listinfo/boston-pm > -- -- Steve Scaffidi <step...@scaffidi.net> _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm