K
kj
One of the things I find most infuriating about Config::Std (aside
from the fact that there's nothing standard about it) is that it
imports the subroutine read_config into the invoking namespace,
whether it is requested or not. I.e. even after
package MyPackage;
use Config::Std ();
one still ends up with a MyPackage::read_config subroutine that
one explicitly did not want.
And one can't simply revert to
BEGIN { require Config::Std; }
because, as it turns out, there is no Config::Std::read_config().
Therefore, if one forgoes the services of Config::Std::import, one
must then go behind the API, because the subroutine that normally
would get exported as "read_config" is actually called
Config::Std::Hash::read_config, at least this time around.
(BTW, these shenanigans seem to me *egregious* coming from the
author of "Perl Best Practices." If these are best practices in
the Perl world, I don't want to see what passes for so-so practices.)
I am sorely tempted to do something like
BEGIN { package Config::Std; use Config::Std }
but in the end I don't know who's more likely to be hoist by his
own petard.
Is there a better work-around to prevent Config::Std from defecating
all over my namespace (other than avoiding Config::Std altogether)?
Bah-humbugly yours,
kj
from the fact that there's nothing standard about it) is that it
imports the subroutine read_config into the invoking namespace,
whether it is requested or not. I.e. even after
package MyPackage;
use Config::Std ();
one still ends up with a MyPackage::read_config subroutine that
one explicitly did not want.
And one can't simply revert to
BEGIN { require Config::Std; }
because, as it turns out, there is no Config::Std::read_config().
Therefore, if one forgoes the services of Config::Std::import, one
must then go behind the API, because the subroutine that normally
would get exported as "read_config" is actually called
Config::Std::Hash::read_config, at least this time around.
(BTW, these shenanigans seem to me *egregious* coming from the
author of "Perl Best Practices." If these are best practices in
the Perl world, I don't want to see what passes for so-so practices.)
I am sorely tempted to do something like
BEGIN { package Config::Std; use Config::Std }
but in the end I don't know who's more likely to be hoist by his
own petard.
Is there a better work-around to prevent Config::Std from defecating
all over my namespace (other than avoiding Config::Std altogether)?
Bah-humbugly yours,
kj