Subject: | It is not possible to avoid interpolation of $0 |
Hello,
It is not possible to avoid interpolation of $0 (placed in a sub) in the
case of InterPolateVars is set to 1. I've tried with \, \\, ...
Thank you by advance and best regards,
Richard
#---------------------------------------------------
Code :
Readonly::Hash my %config => ParseConfig(
-ConfigFile => $config_file,
-InterPolateVars => 1,
-InterPolateEnv => 1,
-IncludeRelative => 1,
-BackslashEscape => 1,
);
#---------------------------------------------------
Config $config_file :
<<include /data/conf_env/_log4perl.conf>>
batch_log_dir = /data/batch/log
<log4perl_batch>
log4perl.logger.batch_general = ${_LOGLEVEL_batch_general},
batch_general
log4perl.appender.batch_general = Log::Log4perl::Appender::File
log4perl.appender.batch_general.append = true
log4perl.appender.batch_general.filename = sub {
$0=~s[(.*\/)?(.*)][$2]; $0=~s[\.pl$][.log]; "$batch_log_dir/$0" }
log4perl.appender.batch_general.layout = PatternLayout
log4perl.appender.batch_general.layout.ConversionPattern = [%d]
[%5p] %m%n
</log4perl_batch>
#---------------------------------------------------
Config file /data/conf_env/_log4perl.conf :
_LOGLEVEL_Screen = DEBUG
_LOGLEVEL_batch_general = DEBUG
_LOGLEVEL_Catalyst = DEBUG
#---------------------------------------------------
Error message :
Can't evaluate 'sub { =~s[(.*/)?(.*)][]; =~s[.pl$][.log];
"/data/batch/log/" }' (syntax error at (eval 46) line 1, near "{ =~"
) at /usr/local/lib/perl5/site_perl/5.8.7/Log/Log4perl/Config.pm line 746.
#---------------------------------------------------