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

推荐订阅源

博客园_首页
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
B
Blog
The Register - Security
The Register - Security
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
F
Full Disclosure
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Blog — PlanetScale
Blog — PlanetScale
Jina AI
Jina AI
美团技术团队
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
D
DataBreaches.Net
Martin Fowler
Martin Fowler
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
The Cloudflare Blog
博客园 - 【当耐特】
U
Unit 42
月光博客
月光博客
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
博客园 - 聂微东
I
InfoQ
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
Cyberwarzone
Cyberwarzone
V
V2EX
S
Securelist
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Security @ Cisco Blogs
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Heimdal Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tor Project 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, 求解。