On Wed Dec 15 04:54:46 2010, marcoep@gmail.com wrote:
Show quoted text> Le Mer 31 Mar 2010 07:24:29, TLINDEN a écrit :
> > It's not possible because includes happens in an earlier stage (before
> > variable interpolation).
>
> Ouch. OK, but, please, make this clear in the documentation.
> Cheers,
> Marco
I would like to add this similar odd behavior:
If you use -DefaultConfig => ..., this config isn't so much a default as
one that's inserted before yours is read in. Thus, if you define:
-DefaultConfig => { FOO => 'bar' },
Then you mention this in your config file:
FOO = baz
SLOO = $FOO
(with -InterPolateVars on, of course), the expected value of SLOO = baz
is NOT produced, rather you get SLOO = 'bar'.... and as an added
obfuscation benefit, the value of FOO turns out to be [ qw (bar baz) ].
The final nail: if you want to use interpolation, you MUST have the
variable defined IN THE CURRENT CONFIG, as there doesn't seem to be any
way to include any sort of default, even leaving it out completely.
(Config::General blows up if it finds a $FOO with no corresponding
FOO=... defined.)
If -DefaultConfig behaved in a more reasonable manner, I would expect it
to use those values only if they're not defined by the user's config
file. Thus, I would expect it to interpolate variables based on either
the user-defined value in the config file or in the default config,
respectively, whichever is defined first. And as Marco is requesting,
any INCLUDES should be sucked in first before interpolation takes place.