http://www.perlmonks.org?node_id=1052660


in reply to Best practice for configuration variables stored in external file

Hi,

I think your solution is not completely wrong. Put your constants into one or more perl modules an use (not import) them where you need it without polluting the namespace. Why shall a textfile which gets parsed by a module be better than a textfile (.pm) which gets parsed by perl itself?

The question is: Do you need the ability to reconfigure at runtime (Constants are constant, aren't they)? Are the config constants bundled in a way, so that these constants belong to a component of your program. But this is the same problem as cutting your program into meaningful pieces (modules).

Opinions from the illuminated monks appreciated.

Best regards
McA

Replies are listed 'Best First'.
Re^2: Best practice for configuration variables stored in external file
by afoken (Chancellor) on Sep 06, 2013 at 19:33 UTC

    Constants belong into the code. Configuration options don't.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      I think then that I'm talking about "constants", not "configuration variables". They are not, at any point, edited from within the script.

      Would "use Module" then be the best way to handle this?