Skip Menu |

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

Report information
The Basics
Id: 47565
Status: resolved
Worked: 2 min
Priority: 0/
Queue: XML-Writer-Nest

People
Owner: metaperl [...] gmail.com
Requestors: ian [...] persistentmobile.com
Cc:
AdminCc:

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



Subject: XML-Writer-Nest-0.04
Date: Sat, 4 Jul 2009 17:47:33 +0100
To: bug-xml-writer-nest [...] rt.cpan.org
From: Ian Shrimpton <ian [...] persistentmobile.com>
Environment: XML-Writer-Nest-0.04 perl 5.8.8 Linux 2.6.18-1.2849.fc6 Description: Unable to nest elements at same level within element, elements are closed in incorrect order Code: #!/usr/bin/perl use strict; use XML::Writer::Nest; my $output; my $writer = new XML::Writer(OUTPUT => $output); my $main = new XML::Writer::Nest(tag => 'main', writer => $writer); my $head = $main->nest('head'); my $body = $main->nest('body'); print STDOUT $output . "\n\n"; Result: <main><head><body></body></head></main> Expected Result: <main><head></head><body></body></main>
Hi, here's the right way to do what you want: #!/usr/bin/perl use strict; use XML::Writer::Nest; my $output; my $writer = new XML::Writer(OUTPUT => $output); my $main = new XML::Writer::Nest(tag => 'main', writer => $writer); { my $head = $main->nest('head'); } { my $body = $main->nest('body'); } print STDOUT $output . "\n\n"; Show quoted text
> Environment: > > XML-Writer-Nest-0.04 > perl 5.8.8 > Linux 2.6.18-1.2849.fc6 > > Description: > > Unable to nest elements at same level within element, elements are > closed in incorrect order > > Code: > > #!/usr/bin/perl > > use strict; > use XML::Writer::Nest; > > my $output; > my $writer = new XML::Writer(OUTPUT => $output); > my $main = new XML::Writer::Nest(tag => 'main', writer => $writer); > my $head = $main->nest('head'); > my $body = $main->nest('body'); > > print STDOUT $output . "\n\n"; > > Result: > > <main><head><body></body></head></main> > > Expected Result: > > <main><head></head><body></body></main>