Steve Scaffidi wrote:
> First, I read this here: http://www.perlmonks.org/?node_id=304883

Yup, that's pretty much the definitive reference on this "feature."


> For the curious, there is a way to make this work the "expected" way:
> 
> 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.

Ummm....

WARN *foo::sub_name: wharrrgarbl at -e line 1
        foo::sub_name() called at -e line 1

I still see a "*" before the sub name when you tried to access it
directly via *__ANON__.

But this works:

perl -Mstrict -w -e 'package foo; use Carp qw(cluck); sub
{*__ANON__="sub_name"; cluck( (caller(0))[3],"(): wharrrgarbl" )}->()'
foo::sub_name(): wharrrgarbl at -e line 1
        foo::sub_name() called at -e line 1

Of course it still isn't achieving the goal of using __ANON__ directly.

 -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