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