in reply to Re^4: How not to use "our"?
in thread How not to use "our"?
's better to export a collective hash (reference) or individual variables (as suggested by JavaFan)?
Personally, I wouldn't export either.
As I attempted to show above, I'd use individual package (our) variables, and use them via fully qualified references:
package MyConfig; our $one = ...; our $two = ...;
use MyConfig; ... if( $x <= $MyConfig::one ) { ...
All the variable are nicely contained within the package stash (symbol table hash); warnings are issued for typos; and where they come from is clearly defined. And by not importing them, you avoid namespace clashes.
If they are truly constants, then I use constant and avail myself of the optimisations that brings.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: How not to use "our"?
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 | |
by JavaFan (Canon) on Nov 30, 2010 at 16:00 UTC |