d13*_*r43 2 perl screen-scraping module http
有没有像File :: Remote那样的perl模块,它可以通过http(只读)工作吗?就像是
$magic_module->open( SCRAPE, "http://somesite.com/");
while(<SCRAPE>)
{
#do something
}
Run Code Online (Sandbox Code Playgroud)
当然是.你可以使用LWP::Simple:
use LWP::Simple;
my $content = get $url;
Run Code Online (Sandbox Code Playgroud)
不要忘记检查内容是否为空:
die "Can't download $url" unless defined $content;
Run Code Online (Sandbox Code Playgroud)
$content将undef在下载过程中发生一些错误.