【发布时间】:2015-01-21 05:01:39
【问题描述】:
我对编程有点陌生,我在编写 Perl 脚本时遇到了一些麻烦,该脚本将从网页中抓取所有图像并将它们保存在指定目录中。
这是我的代码:
use warnings;
use strict;
use lib '/home/User1/strawberry/cpan/build';
use Image::Grab;
$pic = Image::Grab->new(SEARCH_URL=>'http://www.examplesite.com',
REGEXP =>'.*\.gif|.*\.jpg');
my $dir = 'images';
opendir (IMG, ">>$dir") || die "Directory doesn't exist - $!\n";
foreach ($pic) {
print IMG "$_\n";
}
closedir IMG;
这是我在 PuTTY 中运行脚本时遇到的错误:
无法在 @INC 中找到 Image/Grab.pm(@INC 包含: /home/User1/strawberry/cpan/build /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) 在 getimage.pl 第 7 行。开始失败——编译在 getimage.pl 处中止 第 7 行。
感谢您的帮助
【问题讨论】:
标签: perl syntax-error runtime-error perl-module