Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Text-Textile CPAN distribution.

Report information
The Basics
Id: 34242
Status: new
Priority: 0/
Queue: Text-Textile

People
Owner: Nobody in particular
Requestors: ryan [...] cardweb.com
Cc:
AdminCc:

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



Subject: global clobbering of $_
Text-Textile-2.03 Text::Textile clobbers $_ globally in multiple places. Patch against version 2.03 attached, including test case.
Subject: Text-Textile.patch
diff -Nur Text-Textile-2.03/lib/Text/Textile.pm Text-Textile.mine/lib/Text/Textile.pm --- Text-Textile-2.03/lib/Text/Textile.pm 2005-09-22 14:40:05.000000000 -0400 +++ Text-Textile.mine/lib/Text/Textile.pm 2008-03-19 12:41:28.000000000 -0400 @@ -754,7 +754,7 @@ # cleanup-- restore preserved blocks my $i = scalar(@repl); - $out =~ s!(?:<|&lt;)textile#$i(?:>|&gt;)!$_!, $i-- while $_ = pop @repl; + $out =~ s!(?:<|&lt;)textile#$i(?:>|&gt;)!$_!, $i-- while local $_ = pop @repl; # scan for br, hr tags that are not closed and close them # only for xhtml! just the common ones -- don't fret over input @@ -833,7 +833,7 @@ $result =~ s/\001/\n/g; my $i = scalar(@repl); - $result =~ s|<textile#$i>|$_|, $i-- while $_ = pop @repl; + $result =~ s|<textile#$i>|$_|, $i-- while local $_ = pop @repl; # quotalize if ($self->{do_quotes}) { @@ -1031,7 +1031,7 @@ # Restore replacements done earlier: my $i = scalar(@repl); - $text =~ s|<textile#$i>|$_|, $i-- while $_ = pop @repl; + $text =~ s|<textile#$i>|$_|, $i-- while local $_ = pop @repl; # translate entities to characters for highbit stuff since # we're using utf8 diff -Nur Text-Textile-2.03/t/06-extra.t Text-Textile.mine/t/06-extra.t --- Text-Textile-2.03/t/06-extra.t 1969-12-31 19:00:00.000000000 -0500 +++ Text-Textile.mine/t/06-extra.t 2008-03-19 12:47:05.000000000 -0400 @@ -0,0 +1,8 @@ +use Test::More tests=>1; +use Text::Textile qw(textile); + +$_ = 'dontclobberme'; +my $source = "paragraph1\n\nparagraph2\n\n"; +my $dest = textile($source); + +is($_, 'dontclobberme', 'global clobber of $_');