All, I would like some advice/appriasal or even well considered criticism on an development approach we started with but is now looking clunky. The perl compiler can easiliy let though typos in hash references and these errors can take forever to filter throug - often in production for example.
$r->{thisid} = 10; $r->{this_id} = 10;
As part of coding quality control we set up a constants file for record references shared between modules (and developers). So the above is rendered
use constant ID =>'thisid'; . . $r->{(ID)} = 10; . .
Incorrect field indexes entered by bleary eyed developers in such as
$r->{(THISID)}
Will be immediately picked up by the compiler in development and not in production. ..... However This constants file in near 400 lines long and growing. Do the monks have any opinion on whether this was a reasonable strategy or is there a better way to ensure the same level of development robustness? Benno UPDATE - what I actually did Firstly I reread the perl documentation on exporting. Then I split the constants file into logical modules. In my case these were XML tokens, default setting and system tokens. Then I went through each module and changed the blanket includes to be more specific. Since there were 70 modules I wrote some helper scripts to find where the constants were being used and the automatic generation of the header include from within VI using the .!sh command. If anyone wants these I'll post later.

In reply to Advice on Global Constants by benno

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.