【发布时间】:2021-04-16 16:57:56
【问题描述】:
我面临错误“在 /opt/alu-rp/www/cgi/munin-cgi-html 第 54 行调用的未定义子例程 &main::header。”打开 munin 页面时(http://localhost/munin)
Perl 版本:v5.32.0 穆宁版本:v2.0.65
由于在munin-cgi-html中添加了新的条件,能够看到header没有被启动
# grab config
html_startup(\@params);
while(new CGI::Fast){
print header("text/html");
$config = get_config(1);
show_page();
}
:
:
# CGI in perl 5.20 is now seriously broken as it doesn't import into the namespace.
# So we have to delegate explicitly. It's easier than prefixing with CGI:: each use.
# This workaround is applied only if "header" is undefined (i.e. for perl >= 5.20).
if(!defined &header){
*header = sub { return CGI::header(@_); };
*path_info = sub { return CGI::path_info(@_); };
*url = sub { return CGI::url(@_); };
*script_name = sub { return CGI::script_name(@_); };
}
在munin-cgi-html中添加一行可以解决问题。
sub header { return CGI::header(@_); }
但不确定添加此行会有什么影响。 是否需要安装任何特定配置或软件包才能让 Munin 工作?
【问题讨论】: