Thanks Adam,

Yes, local would probably be the trick, but I don't have that luxury. This thing is supposed to plug into a lot of existing code that uses "my" variables. It will work if I eval the manufactured sub each time, I was just trying to find a way around that because it is such a performance hit. I'm becoming convinced that what I want to do is impossible, and for all I know, it's impossible for a good reason :-)

From what I've been reading, the "my" variables live on what is known as a "scratchpad", what I was looking for was a way for the manufactured sub to get access to that scratchpad. Of course the scratchpad changes each time the parent sub is called, so the pointer to it in the manufactured sub would have to change with each invocation. I wonder if the rfc period for perl 6 is closed :-)

Hopefully merlyn will chime in here and tell me why it's such a bad idea to try and do what I am trying to do, because there is probably a good reason not to allow it, I just don't know what that is yet. :-)


In reply to Re: access to my variables from other subs by joe
in thread access to my variables from other subs by joe

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.