tools: template_replace: esacpe braces

To avoid warnings (and in the future, errors) like:

> Unescaped left brace in regex is deprecated here (and will be fatal
> in Perl 5.32), passed through in regex; marked by <-- HERE in
> m/([^{]+)?({ <-- HERE ([^}]+)})?/ at /usr/share/perl5/PVE/Tools.pm
> line 673.

with future perl versions, like Debian Buster for example has.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2018-11-18 16:06:19 +01:00 committed by Wolfgang Bumiller
parent 0681aa7157
commit 14410e5f20

View File

@ -670,7 +670,7 @@ sub template_replace {
return $tmpl if !$tmpl; return $tmpl if !$tmpl;
my $res = ''; my $res = '';
while ($tmpl =~ m/([^{]+)?({([^}]+)})?/g) { while ($tmpl =~ m/([^{]+)?(\{([^}]+)\})?/g) {
$res .= $1 if $1; $res .= $1 if $1;
$res .= ($data->{$3} || '-') if $2; $res .= ($data->{$3} || '-') if $2;
} }