惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

Perl

一段 perl 代码展示如何 all in one 优雅地编写一个异步爬虫 - V2EX Perl 怀旧群 - V2EX 安装社区版 perl 时的注册问题 - V2EX 有没有业余学 perl 作为爱好的 - V2EX perl 还值得学吗 - V2EX 来一起学习 Perl 6 阿 - V2EX Perl 学习地 - V2EX 新手学 perl,想问一下 print 数字的时候,为什么后面总是跟着一个“%” - V2EX perl 的打包部署问题 - V2EX 连永远的毁灭公爵都发布了 perl6还没有完工 - V2EX perl6就要出来了,大家有期待的吗?
Perl 爬取内容失败 - V2EX
akagi · 2014-07-01 · via Perl

使用的是 Mojo::UserAgent, 用来爬取某网站的用户回答列表,但是爬取时会随机在某网页停止,显示

"Can't call method "all_text" on an undefined value at core.pl line 188."

实现如下,

sub get_keyword_list {
my ($ua, @list, $keyword) = @_;

foreach my $l (@list) {
my $tx = $ua->get($l->[0]);
say $l->[0];
# what should it be?
my $answer = $tx->res->dom->at('div.zm-editable-content.clearfix')->all_text;
my $timestamp = $tx->res->dom->at('a.answer-date-link.meta-item')->text;
open my ($tmp), '>>', 'tmp.txt' or die;
say $tmp $answer;
say $tmp $timestamp;
}
}

其中 $l->[0] 取到列表中各网页 url, 类似如下形式: http://www.zhihu.com/question/20304733/answer/25775012

为什么会出现错误,无法理解ing, 求解。