To: | bug-config-std [...] rt.cpan.org |
From: | David Wheeler <david [...] kineticode.com> |
Subject: | No Import Conflict Handling |
Date: | Thu, 29 Dec 2005 20:32:37 -0800 |
I ran into an issue when using Config::Std in a subclass of
Module::Build. Module::Build defines a write_config() method, so when
I used Config::Std, the write_config() method that it imported
overrode the base class implementation. Needless to say, these are
not the same kinds of functions at all.
To get around this, for now, I'm calling the Config::Std functions
directly:
use Config::Std ();
...
Config::Std::Hash::read_config($conf_file => my %conf);
...
Config::Std::Hash::write_config(%conf);
I'm uncomfortable with this approach because these functions are not
documented. I have two proposed solutions for this issue:
1. Add Config::Std::read_config() and Config::Std::write_config(),
document them, and allow them to be called directly with their fully-
qualified names.
2. Allow the names of the functions to be imported to be modified,
something like this:
sub import {
my %export = @_ || (
read_config => 'read_config',
write_config => 'write_config',
);
*{caller()."::$export{read_config}"} =
\&Config::Std::Hash::read_config;
*{caller()."::$export{write_config}"} =
\&Config::Std::Hash::write_config;
}
Thanks!
David