# need to modify directly the HTML::Element package, because HTML::TreeBuilder won't let me # change the class of the nodes it generates package HTML::Element; use Scalar::Util qw(weaken); use vars qw(@ISA); push @ISA, 'HTML::TreeBuilder::XPath::Node'; use XML::XPathEngine; { my $xp; sub xp { $xp ||=XML::XPathEngine->new(); return $xp; } }