提问人:Chella 提问时间:1/11/2016 最后编辑:Chella 更新时间:1/12/2016 访问量:420
无法对第 11 行 sample.pl 未定义的值调用方法“text”
Can't call method "text" on an undefined value at sample.pl line 11
问:
use strict; # safety net
use warnings; # safety net
use feature 'say'; # a better "print"
use Mojo;
my $dom = Mojo::DOM->new;
my $ua = Mojo::UserAgent->new;
$dom= $ua->get('http://search.cpan.org/faq.html')->res->dom;
my $desc=$dom->at('#u')->text;
当我运行此代码时,发生了上述错误。这是我输入的数据表格,以下网页请参考这个
我想要这样的输出只回答。
CPAN Search is a search engine for the distributions, modules, docs, and ID's on CPAN. It was conceived and built by Graham Barr as a way to make things easier to navigate. Originally named TUCS [ The Ultimate CPAN Search ] it was later named CPAN Search or Search DOT CPAN.
If you are having technical difficulties with the site itself, send mail to [email protected] and try to be as detailed as possible in your note describing the problem.
请任何人都可以帮助我
答:
1赞
Logioniz
1/12/2016
#1
像这样的东西:
perl -Mojo -le 'print r g("http://search.cpan.org/faq.html")->dom("#cpansearch > div.pod > p")->map("text")->to_array;'
评论