Skip Menu |
 

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

Report information
The Basics
Id: 89762
Status: open
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: NGLENN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: RNG constructor returns undef with doc parameter
Download (untitled) / with headers
text/plain 798b
Here's some code to demonstrate: use XML::LibXML; #this one works my $rng = XML::LibXML::RelaxNG->new(string => '<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0"> <text/> </element>'); die 'blah' unless $rng; #doesn't die #but this one doesn't my $rng_doc = XML::LibXML->load_xml(string => '<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0"> <text/> </element>'); $rng = XML::LibXML::RelaxNG->new( doc => $rng_doc ); die 'what?!' unless $rng; #dies I wanted to use the doc version of the constructor because I could pass a string pointer to the doc constructor. However, using the doc constructor to create an RNG validator always returns undef! The documentation mentions errors leading to die(), but this program lives and has bad output.
Subject: Re: [rt.cpan.org #89762] RNG constructor returns undef with doc parameter
Date: Fri, 25 Oct 2013 08:46:22 +0200
To: bug-XML-LibXML [...] rt.cpan.org
From: Slaven Rezic <slaven [...] rezic.de>
Download (untitled) / with headers
text/plain 1.5k
"Nathan Gary Glenn via RT" <bug-XML-LibXML@rt.cpan.org> writes: Show quoted text
> Thu Oct 24 19:03:40 2013: Request 89762 was acted upon. > Transaction: Ticket created by NGLENN > Queue: XML-LibXML > Subject: RNG constructor returns undef with doc parameter > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: NGLENN@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=89762 > > > > Here's some code to demonstrate: > use XML::LibXML; > > #this one works > my $rng = XML::LibXML::RelaxNG->new(string => > '<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0"> > <text/> > </element>'); > > die 'blah' unless $rng; #doesn't die > > #but this one doesn't > my $rng_doc = XML::LibXML->load_xml(string => > '<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0"> > <text/> > </element>'); > > $rng = XML::LibXML::RelaxNG->new( doc => $rng_doc ); > die 'what?!' unless $rng; #dies > > I wanted to use the doc version of the constructor because I could pass a string pointer to the doc constructor. However, using the doc constructor to create an RNG validator always returns undef! The documentation mentions errors leading to die(), but this program lives and has bad output. >
The parameter name should be "DOM", not "doc". That said, maybe the constructor should die if it gets misspelled named parammeters. Regards, Slaven -- Slaven Rezic - slaven <at> rezic <dot> de Berlin Perl Mongers - http://berlin.pm.org
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #89762] RNG constructor returns undef with doc parameter
Date: Fri, 25 Oct 2013 08:45:45 +0200
To: bug-XML-LibXML [...] rt.cpan.org
From: Slaven Rezic <slaven [...] rezic.de>
Download (untitled) / with headers
text/plain 1.5k
"Nathan Gary Glenn via RT" <bug-XML-LibXML@rt.cpan.org> writes: Show quoted text
> Thu Oct 24 19:03:40 2013: Request 89762 was acted upon. > Transaction: Ticket created by NGLENN > Queue: XML-LibXML > Subject: RNG constructor returns undef with doc parameter > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: NGLENN@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=89762 > > > > Here's some code to demonstrate: > use XML::LibXML; > > #this one works > my $rng = XML::LibXML::RelaxNG->new(string => > '<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0"> > <text/> > </element>'); > > die 'blah' unless $rng; #doesn't die > > #but this one doesn't > my $rng_doc = XML::LibXML->load_xml(string => > '<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0"> > <text/> > </element>'); > > $rng = XML::LibXML::RelaxNG->new( doc => $rng_doc ); > die 'what?!' unless $rng; #dies > > I wanted to use the doc version of the constructor because I could pass a string pointer to the doc constructor. However, using the doc constructor to create an RNG validator always returns undef! The documentation mentions errors leading to die(), but this program lives and has bad output. >
The parameter name should be "DOM", not "doc". That said, maybe the constructor should die if it gets misspelled named parammeters. Regards, Slaven -- Slaven Rezic - slaven <at> rezic <dot> de Berlin Perl Mongers - http://berlin.pm.org
Download (untitled) / with headers
text/plain 343b
Man I feel dumb! I guess I should read closer. You're probably right about it needing to die, since this is currently undefined behavior and it might throw somebody else. Show quoted text
> The parameter name should be "DOM", not "doc". > > That said, maybe the constructor should die if it gets misspelled > named > parammeters. > > Regards, > Slaven


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.