I have what sounds to me like a simple problem. I want to use a different 'package' in a module for brevity, and I want to export things in the normal package namespace. If I include the package My::foo; alone, my functions and variables export with @EXPORT_OK and our @EXPORT. Perfectly fine no problems. If I then put package barpackage; somewhere for making all the functions/variables not have barpackage::otherpackagestuff:: in front for the sub-package, all my exports are not found. I'm used to C just having extern or include'ing, and not needing to have tricks and hacks just so I can export things without typing 5x the characters for any value/function.

I know it's "bad" programming to pollute a namespace, but it shouldn't be a broken kludge of the language to stop me from overlapping namespaces at all.


In reply to Export and use different package in module by chenhonkhonk

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.