当我尝试在 Debian Jessie (Perl 5.20) 上使用PDF::Table模块时,我收到以下消息:
Useless use of greediness modifier '?' in regex; marked by <-- HERE in m/(\S{20}? <-- HERE )(?=\S)/ at /usr/share/perl5/PDF/Table.pm line 370.
该模块在 Debian Wheezy(使用 Perl 5.014002)上运行良好,但 Perl 5.20 的升级似乎使其无法在 Debian Jessie 上使用。我在这个 bug 上找到的唯一文档是关于 Perl 升级的,但没有提供任何解决方案来解决这个问题。我使用的脚本是 CPAN 上的 PDF::Table 主要示例:
use strict;
use warnings;
use PDF::API2;
use PDF::Table;
my $pdftable = new PDF::Table;
my $pdf = new PDF::API2(-file => "table_of_lorem.pdf");
my $page = $pdf->page;
# some data to layout
my $some_data =[
["1 Lorem ipsum dolor",
"Donec odio neque, faucibus vel",
"consequat quis, tincidunt vel, felis."],
["Nulla euismod sem eget neque.",
"Donec odio neque",
"Sed eu velit."],
#... and so on
];
my $left_edge_of_table = 50;
# build the table layout
$pdftable->table(
# required params
$pdf,
$page,
$some_data,
x => $left_edge_of_table,
w => 495,
start_y => 500,
start_h => 300,
# some optional params
next_y => 750,
next_h => 500,
padding => 5,
padding_right => 10,
background_color_odd => "gray",
background_color_even => "lightblue", #cell background color for even rows
);
$pdf->saveas("table_of_lorem.pdf");
print "Content-type: text/html\n\n";
print "Ok";
我的主机只说我必须“调整我的代码”......你能帮我找到正确的方法吗?我只在使用 PDF::Table 时才注意到这个错误,但是 Perl 5.20 上的另一个 Perl 模块是否有可能出现同样的问题?非常感谢您的帮助!