我正在尝试将我的代码文件夹中存在的文件 img.png 保存到所需位置的另一个具有所需名称的文件。
use Prima qw(Application Buttons StdBitmap FileDialog MsgBox PodView);
my $save = Prima::SaveDialog->new(
text =>'Save Image',
fileName => $save->fileName,
filter => [
['PNG Image' => '*.png'],
],
);
if ( $save->execute ) {
my $x = Prima::Image->load('img.png');
die "$@" unless $x;
die "$@" unless $x->save( fileName);
}
run Prima;
我哪里错了?
答案 0 :(得分:0)
解决。代码可能是这样的:
use Prima qw(Application Buttons StdBitmap FileDialog MsgBox PodView);
my $save = Prima::SaveDialog->new(
text =>'Save Image',
filter => [
['PNG Image' => '*.png'],
],
);
if ( $save->execute ) {
my $x = Prima::Image->load('img.png');
die "$@" unless $x;
die "$@" unless $x->save($save->fileName); <--------------------changed.
}
run Prima;