Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: recursive anonymous subroutines

by ikegami (Patriarch)
on Apr 06, 2006 at 20:05 UTC ( [id://541714]=note: print w/replies, xml ) Need Help??


in reply to Re: recursive anonymous subroutines
in thread recursive anonymous subroutines

How would one do that? I'm curious.

Replies are listed 'Best First'.
Re^3: recursive anonymous subroutines
by TedYoung (Deacon) on Apr 06, 2006 at 20:19 UTC
    OK, I found a way, but you won't like it! :-)
    Use $DB::sub->() but you have to run it under the perl debuger (perl -d):
    sub { print 'A'; $DB::sub->() }->();

    Ted Young

    ($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)

      That only works when the debugger is enabled. For general use, see Devel::Caller.

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Re^3: recursive anonymous subroutines
by chromatic (Archbishop) on Apr 07, 2006 at 07:18 UTC

    I'd write a little very scary, very hairy XS code. I don't know which of three or four approaches would work best, but I'd start by poking around PL_curcop.

      Surely the *best* approach is to not write the scary hairy XS code and just accept that you'll have to use a variable. It's not like variables kill babies or anything.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://541714]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-03-19 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found