0
如何插入环境变量Config::General设置为Config::Any。这是我从我的OX应用程序中提取的配置片段,它返回我的.conf
中指定的数据,除了我无法识别环境变量外。使用Config :: Any和Config :: General驱动程序插入环境变量
has config => (
isa => 'HashRef',
is => 'ro',
lifecycle => 'Singleton',
dependencies => ['config_file'],
block => sub {
my $s = shift;
my $cfg
= load_class('Config::Any')->load_files({
flatten_to_hash => 1,
use_ext => 1,
files => [ $s->param('config_file') ],
General => {
-InterPolateEnv => 1,
},
});
return $cfg->{ $s->param('config_file') };
},
);
这里的一对夫妇尝试对我的配置
<db>
dsn $PERL_FEEDER_DSN
</db>
<db>
dsn $ENV{PERL_FEEDER_DSN}
</db>
的这些都只是包含文字$...
DSN结束。
我以前做过这件事,但我无法弄清楚我是怎么做到的,或者我可能做错了什么。
不谓是什么做的? 'General => { -InterPolateEnv => 1, },' – xenoterracide 2013-03-20 22:21:25
对不起,我的意思是它需要与-InterPolateVars => 1一起指定,以便Config :: General :: Interpolated被加载。 – 2013-03-20 23:28:21
啊,看我可以发誓,文件说,InterPolateEnv暗示InperPolateVars – xenoterracide 2013-03-21 00:13:53