在Perl HTML :: TreeBuilder中获取/设置innerHTML?

在Perl
HTML :: TreeBuilder中获取/设置innerHTML?我可以获得innerHTML但不知道如何设置.

提前致谢.

最佳答案 我不确定这种方法是否能满足你,但你可以使用
pQuery中的
html($html)方法:

This method is akin to the famous
JavaScript/DOM function innerHTML.

If called with no arguments, this will
return the the inner HTML string of
the first DOM element in the pQuery
object.

If called with an HTML string
argument, this will set the inner HTML
of all the DOM elements in the pQuery
object.

至于为什么pQuery可能满足你,引用POD:

pQuery::DOM is roughly an attempt to
duplicate JavaScript’s DOM in Perl. It
subclasses
HTML::TreeBuilder/HTML::Element so
there are a few differences to be
aware of. See the pQuery::DOM
documentation for details.

点赞