title: Why does XML::LibXML::Document's toString() give me "SCALAR(...)" instead of an XML string?
body: <p>Here is a code sample that reproduces the behaviour I wonder about:</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  
  use XML::LibXML;
  
  my $myXMLdocument = XML::LibXML::Document-&gt;new();
  
  my $myXML = $myXMLdocument-&gt;createElement("myXML");
  $myXMLdocument-&gt;addChild($myXML);
  
  my $element = $myXMLdocument-&gt;createElement("element");
  $myXML-&gt;addChild($element);
  
  my $node = $myXMLdocument-&gt;createElement("node");
  $element-&gt;addNewChild('', $node);
  $node-&gt;addNewChild('', $myXMLdocument-&gt;createAttribute( "key" =&gt; "value"));
  
  print "$myXMLdocument-&gt;toString(2)\n";
  </code></pre>
  
  <p>The output :</p>
  
  <pre><code>XML::LibXML::Document=SCALAR(0x8f5a6f8)-&gt;toString(2)
  </code></pre>
  
  <p>I understand that this is some sort of handle for the document structure passed around by <a href="https://metacpan.org/module/XML%3a%3aLibXML" rel="nofollow"><code>XML::LibXML</code></a>.</p>
  
  <p>Now why doesn't <code>toString</code> serialize it to human readable XML?</p>
  
  <p>I may be extremely naïve about <code>XML::LibXML</code>; this is my first time using it instead of spewing out random XML with Bash's echo.</p>