Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: ams [...] ludd.ltu.se
Cc:
AdminCc:

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



Subject: set_pretty_print("indented_c") -> Undefined subroutine &Text::Wrap::wrap
Date: Fri, 30 Sep 2011 23:42:37 +0200 (MEST)
To: bug-XML-Twig [...] rt.cpan.org
From: Martin Str|mberg <ams [...] ludd.ltu.se>
Hello. Test program (twig_bug1.pl): #!/usr/bin/perl -w use strict; use XML::Twig; my $show_bug = shift; my $t= XML::Twig->new(); $t->parse( '<d><title>title</title><para>p 1</para><para>p 2</para></d>'); if( $show_bug ) { $t->set_pretty_print("indented_c"); } else { $t->set_pretty_print("wrapped"); } $t->print; End of test program. Run as "./twig_bug1.pl" -> all is fine. Run as "./twig_bug1.pl Oops" -> Undefined subroutine &Text::Wrap::wrap called at /usr/share/perl5/XML/Twig.pm line 7729. Patch: diff -ru XML.org/Twig.pm XML/Twig.pm --- XML.org/Twig.pm 2011-09-30 23:13:55.000000000 +0200 +++ XML/Twig.pm 2011-09-30 23:23:14.000000000 +0200 @@ -7682,7 +7682,7 @@ { croak "invalid pretty print style '$style'" unless( exists $pretty_print_style{$style}); $pretty= $pretty_print_style{$style}; } - if( ($pretty == $WRAPPED) || ($pretty == $INDENTEDA) ) + if( ($pretty == $WRAPPED) || ($pretty == $INDENTEDA) || ($pretty == $INDENTEDC)) { XML::Twig::_use( 'Text::Wrap') or croak( "Text::Wrap not available, cannot use 'wrapped' style"); } return $old_pretty; } It shouldn't matter but I'm running Debian lenny == 5.0.8, which uses "perl5 (revision 5 version 10 subversion 0)" on "Linux hume 2.6.26-2-amd64 #1 SMP Mon Sep 19 06:13:12 UTC 2011 x86_64 GNU/Linux" XML::Twig from Debian is 3.32, but 3.39 from cpan.org has the same bug. Thank you for XML::Twig and perl. -- MartinS
Subject: Re: [rt.cpan.org #71375] set_pretty_print("indented_c") -> Undefined subroutine &Text::Wrap::wrap
Date: Sat, 01 Oct 2011 11:51:28 +0200
To: bug-XML-Twig [...] rt.cpan.org
From: mirod <xmltwig [...] gmail.com>
Oops! I fixed it, the patched version is on github and xmltwig.org. I still have to add the tests later, when I come back from the beach ;--) Thanks a lot for the report and the patch. I applied a generalized fix, that should make it easier should I add more styles that use Text::Wrap. __ mirod On 09/30/2011 11:42 PM, Martin Str|mberg via RT wrote: Show quoted text
> Fri Sep 30 17:42:51 2011: Request 71375 was acted upon. > Transaction: Ticket created by ams@ludd.ltu.se > Queue: XML-Twig > Subject: set_pretty_print("indented_c") -> Undefined subroutine&Text::Wrap::wrap > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: ams@ludd.ltu.se > Status: new > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=71375> > > > Hello. > > > Test program (twig_bug1.pl): > #!/usr/bin/perl -w > > use strict; > > use XML::Twig; > > my $show_bug = shift; > > my $t= XML::Twig->new(); > $t->parse( '<d><title>title</title><para>p 1</para><para>p 2</para></d>'); > > if( $show_bug ) { > $t->set_pretty_print("indented_c"); > } else { > $t->set_pretty_print("wrapped"); > } > > $t->print; > > End of test program. > > > Run as "./twig_bug1.pl" -> all is fine. > Run as "./twig_bug1.pl Oops" -> > Undefined subroutine&Text::Wrap::wrap called at /usr/share/perl5/XML/Twig.pm line 7729. > > > Patch: > diff -ru XML.org/Twig.pm XML/Twig.pm > --- XML.org/Twig.pm 2011-09-30 23:13:55.000000000 +0200 > +++ XML/Twig.pm 2011-09-30 23:23:14.000000000 +0200 > @@ -7682,7 +7682,7 @@ > { croak "invalid pretty print style '$style'" unless( exists $pretty_print_style{$style}); > $pretty= $pretty_print_style{$style}; > } > - if( ($pretty == $WRAPPED) || ($pretty == $INDENTEDA) ) > + if( ($pretty == $WRAPPED) || ($pretty == $INDENTEDA) || ($pretty == $INDENTEDC)) > { XML::Twig::_use( 'Text::Wrap') or croak( "Text::Wrap not available, cannot use 'wrapped' style"); } > return $old_pretty; > } > > > > It shouldn't matter but I'm running Debian lenny == 5.0.8, which uses > "perl5 (revision 5 version 10 subversion 0)" on > "Linux hume 2.6.26-2-amd64 #1 SMP Mon Sep 19 06:13:12 UTC 2011 x86_64 GNU/Linux" > > XML::Twig from Debian is 3.32, but 3.39 from cpan.org has the same bug. > > > Thank you for XML::Twig and perl. > >
Subject: Re: [rt.cpan.org #71375] set_pretty_print("indented_c") -> Undefined subroutine &Text::Wrap::wrap
Date: Sat, 1 Oct 2011 12:54:21 +0200 (MEST)
To: bug-XML-Twig [...] rt.cpan.org
From: Martin Str|mberg <ams [...] ludd.ltu.se>
Hello. Looking at the other bugs, it's possible that 38783 is the same problem. Perhaps you should ask that reporter trying the patched version. -- MartinS
fixed in 3.40 __ mirod