How is this not a bug in perl 5.14?

Because it's your bug. As I said in my first response, things aren't happening when you think they're happening. If you put your code in separate files and used them, you wouldn't have this problem.

The strict check happens at the end of compilation. Your import call hasn't happened yet, so of course the importing of your variable hasn't happened yet.

Throw a BEGIN block around that import and strict will still complain because nothing gets imported because the assignment to @EXPORT hasn't happened yet.

Throw a BEGIN block around that assignment and you'll finally get things to start to work. You'll have a mess on your hands, because you'll have to juggle the details of when things happen and in which order and why, especially with everything jumbled together in the same file.

That's why the rest of us use separate files and let use manage all of those details for us. It's not complicated. It's not working around bugs in Perl (you have the same problem with every version of Perl 5 I've ever used). It's knowing what happens when and why and letting the computer worry about that. Having to rearrange code to get the order of declarations right wasn't fun in Pascal (and almost 45 years later, computer science has moved on.)


In reply to Re^23: can't import using exporter by chromatic
in thread can't import using exporter by perl-diddler

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.