in reply to XML::Writer oddness
XML::Writer blesses $doc for some reason. I presume IO::Compress::gzip checks for that even though it would have no effect in this case. Copying $doc doesn't copy the blessing.
use strict; use warnings; use Devel::Peek qw( Dump ); use Scalar::Util qw( blessed ); use XML::Writer qw( ); my $writer = new XML::Writer(OUTPUT => \my $doc); $writer->startTag("root"); $writer->startTag("foo"); $writer->endTag("foo"); $writer->endTag("root"); $writer->end(); Dump $doc; print(blessed(\$doc)?1:0, "\n"); # 1 my $copy = $doc; Dump $copy; print(blessed(\$copy)?1:0, "\n"); # 0
SV = PVMG(0x18c5614) at 0x182a39c REFCNT = 2 FLAGS = (PADMY,OBJECT,POK,pPOK) IV = 0 NV = 0 PV = 0x1922fbc "<root><foo></foo></root>\n"\0 CUR = 25 LEN = 28 STASH = 0x19154b4 "XML::Writer::_String" 1 SV = PVMG(0x18c5654) at 0x1915784 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) IV = 0 NV = 0 PV = 0x1925184 "<root><foo></foo></root>\n"\0 CUR = 25 LEN = 28 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Writer oddness
by TedHopp (Novice) on Feb 24, 2010 at 17:53 UTC | |
by ikegami (Patriarch) on Feb 24, 2010 at 20:15 UTC | |
by TedHopp (Novice) on Feb 25, 2010 at 02:48 UTC | |
by ikegami (Patriarch) on Feb 25, 2010 at 04:48 UTC | |
by TedHopp (Novice) on Feb 25, 2010 at 20:03 UTC | |
|