Skip Menu |

This queue is for tickets about the XML-Twig CPAN distribution.

Report information
The Basics
Id: 26136
Status: resolved
Priority: 0/
Queue: XML-Twig

People
Owner: Nobody in particular
Requestors: admiral.grinder [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.28
Fixed in:
  • 3.30
  • 3.31
  • 3.32



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);
Subject: Re: [rt.cpan.org #26136] set_doctype() not working as documented.
Date: Fri, 06 Apr 2007 20:15:01 +0200
To: bug-XML-Twig [...] rt.cpan.org
From: mirod <mirod [...] xmltwig.com>
admiral.grinder@gmail.com via RT wrote: Show quoted text
> Fri Apr 06 11:09:19 2007: Request 26136 was acted upon. > Transaction: Ticket created by admiral.grinder@gmail.com > Queue: XML-Twig > Subject: set_doctype() not working as documented. > Broken in: 3.28 > Severity: Normal > Owner: Nobody > Requestors: admiral.grinder@gmail.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=26136 > > >
>>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.
Thanks, I have applied the patch. Testing it showed a bug in the doctype method though, so I have to fix it before uploading the patched version to http://xmltwig.com/xmltwig/ (it's an annoying bug as it touches code that has to deal with changes between versions of XML::Parser so it might take me until tomorrow to fix it). -- mirod