This is more a question of what is considered good style then functional programming. I have a perl module/class that is dependant on about a dozen 'global' variables being imported from a "config.pm". All other modules in this application use this same "config.pm" to get at these 'global' variables as well. Is this considered acceptable style or should all code (especially classes) be totaly decoupled? I don't suppose it would be any great hardship to pass a ref of a hash that includes all these variables to every single function call in this application but that doesn't seem to tidy to me. An thoughts/criticism one way or the other?

On a related topic... If I declare a scalar as a constant in a module then export that scalar will it remain a constant? I'm not so much worried about it remaining constant as I am get compile time replacement in any script/module that has that scalar exported into it. Does that make sense to anyone else?


In reply to Coding Perl With Style by Dogma

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.