Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Getting a code ref to main

by Courage (Parson)
on Nov 19, 2002 at 07:37 UTC ( #214047=note: print w/replies, xml ) Need Help??

in reply to Getting a code ref to main

main_cv just returns Perl internal variable PL_main_cv which in turn serves special purposes.

As I see a situation, it is a very special *CV value that can not be deparsed (like can not be deparsed, say, sort internal function), and there should be special effort be made to make main_cv deparse-able, which, in turn, seems do-able to me, but not implemented nowadays.

Best wishes,
Courage, the Cowardly Dog

Replies are listed 'Best First'.
Re^2: Getting a code ref to main
by diotalevi (Canon) on Nov 19, 2002 at 13:16 UTC

    Well... ok. So then if main_cv isn't good enough is there a way to get a proper code reference to the main() subroutine or whatever the heck it's called?

    __SIG__ use B; printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://214047]
[shmem]: hm. That should be "an artist's expression"
[RonW]: Happy Thanksgiving Eve
[RonW]: and no panic, here. We're staying home, safe from the frenzy in the stores
[AnomalousMonk]: choroba: It even has Rama's (relatively) high rate of spin, although I don't know if it's axial spin.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2017-11-22 16:52 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (327 votes). Check out past polls.