Perl 5.22以后的语法更新:Unescaped left brace in regex is illegal here in regex; marked by

虚拟主机的操作系统升级后,perl的版本也升级到了5.26.x,awstats的统计中断了,从后台的错误信息:

Unescaped left brace in regex is illegal here in regex; marked by

查了一下,此类信息应该是从5.22开始的:
As written by @Leobaillard you can use his patch. If you want to fix this with your editor (vi) you can go to line 3936 and make the following changes
$ vi buildroot/output/host/usr/bin/automake
goto line :3936 and change
$text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
to
$text =~ s/\$\{([^ \t=:+\{\}]+)\}/substitute_ac_subst_variables_worker ($1)/ge;
The error is with automake and perl v5.26.

从perl v5.22开始:不再推荐在正则表达式中使用 {,而且如果没有转义 \{ 会有错误警告,从v5.26开始:不仅有警告,还会有语法错误提示。

解决方法:在所有正则表达式的 "{" "}" 前面增加转义符:

diff -r1.1008 awstats.pl
9045,9050c9045,9050
< $LogFormatString =~ s/\"%{Referer}i\"/%refererquot/g;
< $LogFormatString =~ s/\"%{User-Agent}i\"/%uaquot/g;
< $LogFormatString =~ s/%{mod_gzip_input_size}n/%gzipin/g;
< $LogFormatString =~ s/%{mod_gzip_output_size}n/%gzipout/g;
< $LogFormatString =~ s/%{mod_gzip_compression_ratio}n/%gzipratio/g;
< $LogFormatString =~ s/\(%{ratio}n\)/%deflateratio/g;
---
> $LogFormatString =~ s/\"%\{Referer\}i\"/%refererquot/g;
> $LogFormatString =~ s/\"%\{User-Agent\}i\"/%uaquot/g;
> $LogFormatString =~ s/%\{mod_gzip_input_size\}n/%gzipin/g;
> $LogFormatString =~ s/%\{mod_gzip_output_size\}n/%gzipout/g;
> $LogFormatString =~ s/%\{mod_gzip_compression_ratio\}n/%gzipratio/g;
> $LogFormatString =~ s/\(%\{ratio\}n\)/%deflateratio/g;

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值