{ no warnings 'redefine'; sub Test::XML::XPath::XML::LibXML::new { my ($class,$xml) = @_; my $p = XML::LibXML->new; $p->line_numbers(1); my $document = $p->parse_string($xml) or croak("Could not parse XML: $xml"); my $xpc = XML::LibXML::XPathContext->new( $document->documentElement ); $xpc->registerNs( x => "http://www.w3.org/1999/xhtml" ); return bless { xpath => $xpc } => $class; } }