Subject: | set_doctype() not working as documented. |
From the POD:
"
set_doctype ($name, $system, $public, $internal)
Set the doctype of the element. If an argument is undef (or not
present) then its former value is retained, if a false ('' or 0) value
is passed then the former value is deleted;
"
However when passing something like:
set_doctype($name, undef, undef, $internal)
It would remove the system id and the public id. Looking at the code,
the problem is that 'twig_doctype' is set to a new empty hash ref
unconditionally each time the function is called. I have attached a
patch that puts in a check for this.
Subject: | XML-Twig-3.29-set_doctype_bug_fix.diff |
diff -uNr XML-Twig-3.29.orig/Twig.pm XML-Twig-3.29/Twig.pm
--- XML-Twig-3.29.orig/Twig.pm 2007-01-22 04:38:15.000000000 -0500
+++ XML-Twig-3.29/Twig.pm 2007-04-05 14:54:09.801984800 -0400
@@ -2416,7 +2416,7 @@
sub set_doctype
{ my( $t, $name, $system, $public, $internal)= @_;
- $t->{twig_doctype}= {};
+ $t->{twig_doctype}= {} unless defined $t->{twig_doctype};
my $doctype= $t->{twig_doctype};
$doctype->{name} = $name if( defined $name);
$doctype->{sysid} = $system if( defined $system);