The code was not broken in several ways. It was broken in a single way; it referenced (caller)[1], the calling program name, rather than (caller)[0], the calling package name. As I said before, it was a mistype. I'm sorry to have caused you so much anger over it.

The pragmas do export lexically, this is correct. You are also correct in saying that my module doesn't import them into the current lexical scope. It imports them into the current package scope. However, based on inferences from the AM poster (and conversations that I had with his non-AM identity later), he wasn't interested in the lexical behaivor of strict. He was interested in binding several modules together in a single use statement, which is really only possible with Perl5 by using the technique above, short of XS. So, in this case, you are correct in that my solution is not perfect, but then there is no perfect solution to this scenerio.

As to whether the "use strict" and "use warnings" importation works, I *REALLY* suggest you try an example. Really. It does work. If you need help writing a test case, I can assist you.

I normally do test code, but I was in a meeting and didn't have time to. I only posted because I was sure of the solution, and that I had noticed almost a dozen incorrect or unhelpful posts in the thread. Unfortunately, I made a mistake in typing the solution, and so here we are.


In reply to Re: Re: Re: Re: Re: How do I make one package use a module from another package? by jryan
in thread How do I make one package use a module from another package? by Anonymous Monk

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.