更新了一堆CPAN模块后,遇到此代码不再运行并向构造函数"提供了大量参数。错误。
use Image::Imlib2::Thumbnail::Scaled;
my $thumbnail= Image::Imlib2::Thumbnail::Scaled->new({
sizes => [
{ width => 300, height => 300, name => 'large' },
{ width => 240, height => 240, name => 'medium' },
{ width => 150, height => 150, name => 'small' },
]
});
答案 0 :(得分:1)
最新版本的Image :: Imlib2 :: Thumbnail :: Scaled(0.05)将构造函数从版本0.01 / 0.02 / 0.03 / 0.04更改为接受哈希,现在在hashref上失败,因此任何以前的代码都需要更新或它会失败。
解决我的问题:
my $thumbnail= Image::Imlib2::Thumbnail::Scaled->new({
sizes => [
{ width => 300, height => 300, name => 'large' },
{ width => 240, height => 240, name => 'medium' },
{ width => 150, height => 150, name => 'small' },
]
});
更改为:
my $thumbnail= Image::Imlib2::Thumbnail::Scaled->new(
sizes => [
{ width => 300, height => 300, name => 'large' },
{ width => 240, height => 240, name => 'medium' },
{ width => 150, height => 150, name => 'small' },
]
);
(删除{和})