Skip Menu |

This queue is for tickets about the Config-General CPAN distribution.

Report information
The Basics
Id: 33218
Status: resolved
Priority: 0/
Queue: Config-General

People
Owner: tlinden [...] cpan.org
Requestors: richardgerber [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.37
Fixed in: (no value)



Subject: -BackslashEscape => 1 problem with \$
Hi, There is a problem with the option BackslashEscape and escaping the $ sign (on Win32 platform): ----------------------------------------------------- Configuration file: <my_conf> foo1 = bar foo2 = $foo1 bar = this\$is </my_conf> ----------------------------------------------------- Perl test script: #!perl use strict; use warnings; use Data::Dumper; use Config::General; my %conf = new Config::General( -ConfigFile => './test.conf', -InterPolateVars => 1, -InterPolateEnv => 1, -IncludeRelative => 1, -BackslashEscape => 1, )->getall(); print Dumper \%conf; ----------------------------------------------------- Result: $VAR1 = { 'my_conf' => { 'bar' => 'this', 'foo2' => 'bar', 'foo1' => 'bar' } }; ----------------------------------------------------- Result for $conf{my_conf}{bar} should be: "this$is" and not "this". Thank you and best regards, Richard Gerber
This option removes all backslashes after reading the config. Therefore the $ sign appears as plain unescaped $ sign. However, variable interpolation happens later, thus it catches the $ sign as variable identifier. You might consider to omit -BackslashEscape when -InterpolateVars is turned on. This way you can escape $ signs too.
This is not going to change.