Re: XML::LibXML-objects in scalar context

Nick Wellnhofer <[email protected]> Tue, 08 Jul 2014 16:05:16 +0200
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
On 08/07/2014 15:33, Vladimir Melnik wrote:
> I've upgraded XML::LibXML from 1.x to 2.x and now all objects like ::Document, ::Element or ::Node return their textContent() when I mention them with no methods given - e.g. $log->trace("Information has been loaded as $dom");
>
> I've got used to log object's class names with their unique identifiers, so that's why I need to mention the object in the scalar context, because it's pretty good to find other mentions of the same object in log-files.
>
> Can I change its behavior with some option?

At some point, the stringification operators of XML::LibXML objects were 
overloaded. You can't change that but you can use the 'ref' function and 
'refaddr' from Scalar::Util to get the object type and address.

Nick

_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs