in reply to Re^2: How not to use "our"?
in thread How not to use "our"?
If you think about it, a package symbol table (stash) *is* a hash, so the individual package variables within a package who's only purpose is to hold constants or configuration parameters is already organised as you would like it.
If you then avoid exporting the individual variables and use them as $config::one, $config::two etc. then you've got the best of both worlds.
The variables are nicely organised, and you also get typo checking at compile time:
>perl -c -wE"package x;our $fred=50;package main; print $x::fred,$x::d +erf" Name "x::derf" used only once: possible typo at -e line 1. -e syntax OK
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How not to use "our"?
by Anonymous Monk on Nov 30, 2010 at 10:46 UTC | |
by BrowserUk (Patriarch) on Nov 30, 2010 at 11:02 UTC | |
by Anonymous Monk on Nov 30, 2010 at 14:32 UTC | |
by JavaFan (Canon) on Nov 30, 2010 at 15:22 UTC | |
by Anonymous Monk on Nov 30, 2010 at 15:51 UTC | |
|