use WWW::Mechanize;
use HTML::TreeBuilder::XPath;
my $mech = new WWW::Mechanize;
my $tree = new HTML::TreeBuilder::XPath;
my $url = "http://www.elaws.gov.bw/wondersbtree.php";
$mech->get($url);
$tree->parse($mech->content());
@nodes = $tree->findnodes("//p[font = 'PRINCIPAL LEGISLATION']");
print @nodes[0]->as_HTML;
上面的代码打印出搜索到的 HTML 元素,但它缺少最终</p>
标记。为什么?这是故意的还是模块中的错误?