I'm working on a fairly large project and decided to split things up nicely into packages. One of these packages is called dslDefine. It's in /usr/local/lib/perl5/5.6.0/dslDefine.pm. I use exporter to export out some variables (lexically scoped) such as usernames and such that should be visible everywhere. I have all the variables exported thusly:

our @EXPORT = qw($VAR1 $VAR2...);

This library is used in dslRB (/usr/local/lib/perl5/5.6.0/dslRB.pm) via a standard use statement. The problem I'm having is that the variables defined in dslDefine, while apparently exported (No complaints from "use strict"), yield an undefined variable error whenever I try to use them.

Does anyone have any idea how to resolve this? If there's a vastly superior way to go about this, please let me know.

An 8 bit man in a 32 bit world.


In reply to Variable scoping in packages by gomez18

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.