Re: XML::LibXML-objects in scalar context

Vladimir Melnik <[email protected]> Tue, 8 Jul 2014 17:02:18 +0300
Newsgroups gmane.comp.lang.perl.xml
Organization Uplink (http://uplink.ua/)
Message-ID <[email protected]>
On Tue, Jul 08, 2014 at 04:05:16PM +0200, Nick Wellnhofer 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.

Thanks! What really scares me - is an idea of changing all '... $object ...' to something like '..." . ref($object) . "(" . refaddr($object) . ") ...'. :)

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