Dear colleagues,

I upgraded XML::LibXML from 1.x to 2.x and now all its objects return their textContent() when no methods are given.

I've got used to log object's class names with their unique identifiers, so now I can't just say something like: $log->trace("Information has been loaded as $dom");

ow to get object's name and ID?

Thank you!

V.Melnik

P.S. Updated:

sub mm_sprintify { my($message, @values) = @_; return($message) unless(@values); for(my $i = 0; $i < @_; $i++) { given($values[$i]) { when(undef) { $values[$i] = "< undef >"; } when(blessed($_)) { $values[$i] = sprintf("[%s\@0x%x +]", blessed($_), refaddr($_)); } when(ref($_) eq 'HASH') { $values[$i] = Dumper($_); } } } return(sprintf($message, @values)); }

So, now I say $log->debug("The %s %s is loaded as %s", $element_name, $element_type, $element_dom); and feeling quite happy.


In reply to How to use object's reference in "object" context if being used in scalar context it does something wrong? by v_melnik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.