无法在第 11 行 sample.pl 对未定义的值调用方法 "text"


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 cpansearch@perl.org and try to be as detailed as possible in your note describing the problem.

请任何人都可以帮助我

像这样:

perl -Mojo -le 'print r g("http://search.cpan.org/faq.html")->dom("#cpansearch > div.pod > p")->map("text")->to_array;'

相关内容

  • 没有找到相关文章

最新更新