Get at the raw xml behind an XML::XPath object
XML::XPath is a cool module which gives you access to your XML using XPath
However, once you have your XML::XPath object (which you’ve received from some subroutine, for example), I couldn’t find a documented way of accessing the raw XML. Maybe I haven’t looked deep enough, but the below hack works fine for me.
my $xp = get_xpath_object();
print $xp->{_xml};
Note that this is a hack and it breaks all encapsulation. Use it with care.