main CV?

F

Ferry Bolhar

Hi,

in the Perl guts, a function like

sub {....}

is represented by a CV. The CvROOT/CvSTART fields
in the CV point the compiled OP tree where the CvPADLIST/
CvPADNAME fields point the scratch pad array (the "scope"
of the function).

In the case of named functions, the GvCV field of the GV (the
"typeglob") will point to the CV of the function. So, for a
function "hello", I can get a reference to its CV by writing

$hello_cv = *hello{CODE};

However, how can I locate the CV representing the "main"
function (the code outside any function)? There is a package
(stash) named "main::" but there is no function named like this.

Is there a way to find the main CV from Perl?

Kind greetings,

Ferry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top