in reply to Re: XML::Writer oddness
in thread XML::Writer oddness

Thanks. That makes sense. Courtesy of XML::Writer, \$doc is a reference to an XML::Writer::_String object instead of a reference to a scalar, as I expected.

gzip does lots of different things depending on its first arg. Of course, the docs for Gzip say that if the first arg isn't something it expects (a filename, filehandle, scalar reference, array reference, or an Input FileGlob string), it will return undef. Instead, it dies. How rude.

Replies are listed 'Best First'.
Re^3: XML::Writer oddness
by ikegami (Patriarch) on Feb 24, 2010 at 20:15 UTC

    \$doc is a reference to an XML::Writer::_String object instead of a reference to a scalar,

    Well, it's both, seeing as $doc is a scalar. And furthermore, the contents of the scalar are obviously meant to be used as a string (If not, $doc would be given a reference.) So don't be afraid to use it as a string.

      So don't be afraid to use it as a string.

      Heh. Well, doing just that is what led to the problem with gzip. :-)

        Magics collided. Happens. Using "$doc" instead of $doc you make a copy.