First, I'll rant about wanting to mix code and data

Well, I'm not really trying to mix data, so much as providing the programmer with options. The Package name is variable purely so that the programmer can create multiple copies of the same dataset. It should never be selected from using data, same as one shouldn't have "soft" references from data either.

what if they ask for "main" as the package to import their variables!?

I would hope it would create a bunch of variables in main. Yes, this would trample any existing variables of the same name, but that's why the programmer should know what names the script is being called on :)

Having said that, one option is to do as the Exporter does with the import routine, messing with globs to copy values.

I was afraid that might be the answer. Thanks.


In reply to RE:(2) Variable Package Names? by swiftone
in thread Variable Package Names? by swiftone

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.