diotalevi has asked for the wisdom of the Perl Monks concerning the following question:

blakem brings up perl's method cache in Re: Now you see it, now you don't and now I'm wondering if there is any way to inspect it. Most of the things I do are pretty prosaic and probably are handled by it, somethings are pretty wacky and are *maybe* handled by it. But as it stands I have no way to know either way. So is there any way to get insight into this thing? Where does it live in the source? I haven't noticed it around anywhere while poking through the source. Can I get runtime statistics on what is and isn't in the cache? Does it partition by object, class or some other unspecified criteria? When are things expired from it?

Replies are listed 'Best First'.
Re: Inspecting perl's method cache?
by jand (Friar) on May 30, 2003 at 03:24 UTC
    The method cache just lives in the GP of each glob. The CV entry is only valid if the CVGEN is either 0 or equal to PL_sub_generation. PL_sub_generation is incremented each time you create a new glob, or you create a new ref to a sub and similar things that might invalidate the previous method lookup.