Since I want to develop a script to find all of these variables automatically, I'll need PadWalker just to find them. However, once I've gotten their names, and given that the reference to them seems to be incorrect, I need some other way to determine how much memory they're using. So, it comes down to this question - If I know the name of a Perl module, and I know the name of a "my" variable at file level in that module, how do I determine how much memory it's using?

The test code I presented was mainly to show a problem that I saw in PadWalker. However, to create a truely automated script, I can't count on having a function like get_mem() in each module. I've thought about writing a generic get_mem()-like function and adding it to packages automatically, but in that case, it would not know about specific variables in each package. All suggestions gratefully accepted!


In reply to Re^10: Finding file level lexical variables by johndeighan
in thread Finding file level lexical variables by johndeighan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.