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

Indeed it does. That leads me to wander off topic. I had tried $doc = "$doc";, which was close but does not work. Even this does not work:
my $copy = $doc; undef *doc; $doc = $copy;
After that, $doc is still a blessed object (although $copy isn't). From this, I conclude that I don't understand symbol tables. Why doesn't it work to undef everything about $doc? (For that matter, why isn't $copy a blessed object?) Is there a way to "unbless" $doc and to remove its object flag after it has been mucked with by XML::Writer?

Replies are listed 'Best First'.
Re^7: XML::Writer oddness
by shmem (Chancellor) on Feb 25, 2010 at 22:35 UTC
    After that, $doc is still a blessed object (although $copy isn't).

    In the OP, you have $doc declared as my variable, so fiddling around with the symbol table doesn't do anything to my $doc.

Re^7: XML::Writer oddness
by ikegami (Patriarch) on Feb 25, 2010 at 23:37 UTC
    my has Perl use a lexically scoped variable instead of global package variables. Freeing the similar named package variable does not affect the lexical.

    There doesn't seem to be anyway to unbless in Perl's API.