我正在使用 Chart 模块从 CSV 数据生成 PNG 格式的图表:
效果很好,图表看起来不错,但我收到了undef
值警告(上图末尾有 3 个这样的值):
# ~/txv3.pl "./L*TXV3*.csv" > /var/www/html/x.html
Generating chart: L_B17_C0_TXV3LIN_PA3_TI1_CI1
Use of uninitialized value $label in length at /usr/share/perl5/vendor_perl/Chart/Base.pm line 3477, <> line 69.
Use of uninitialized value in subroutine entry at /usr/share/perl5/vendor_perl/Chart/Base.pm line 3478, <> line 69.
Use of uninitialized value $label in length at /usr/share/perl5/vendor_perl/Chart/Base.pm line 3477, <> line 69.
Use of uninitialized value in subroutine entry at /usr/share/perl5/vendor_perl/Chart/Base.pm line 3478, <> line 69.
Use of uninitialized value $label in length at /usr/share/perl5/vendor_perl/Chart/Base.pm line 3477, <> line 69.
Use of uninitialized value in subroutine entry at /usr/share/perl5/vendor_perl/Chart/Base.pm line 3478, <> line 69.
我需要摆脱这些警告,因为它们在这里毫无用处,而且它们使我的 Hudson 工作日志不可读。
所以我试过(在 CentOS 6.4 / 64 位上使用 perl 5.10.1):
#!/usr/bin/perl -w
use strict;
....
$pwrPng->set(%pwrOptions);
$biasPng->set(%biasOptions);
my $pwrPngFile = File::Spec->catfile(PNG_DIR, "${csv}_PWR.png");
my $biasPngFile = File::Spec->catfile(PNG_DIR, "${csv}_BIAS.png");
{
no warnings;
$pwrPng->png($pwrPngFile, $pwrData);
$biasPng->png($biasPngFile, $biasData);
}
但是警告仍然被打印出来。
请问有什么建议吗?