develooper Front page | perl.perl5.porters | Postings from March 2008

Re: [perl #52104] Text::Wrap::wrap() generates a segfault with Cyrillic characters when the utf8 flag is turned on

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
March 28, 2008 17:29
Subject:
Re: [perl #52104] Text::Wrap::wrap() generates a segfault with Cyrillic characters when the utf8 flag is turned on
Message ID:
20080329002918.GA79799@plum.flirble.org
On Fri, Mar 28, 2008 at 10:58:25PM -0000, Robin Barker wrote:
> From: Frédéric Buclin [mailto:lpsolit@gmail.com]
> > For all installations which do not have the not-yet-released Perl 5.8.9, 
> > which workaround(s) do they have? On critical installations, it's hard 
> > to upgrade Perl as it's a pretty heavy change.
> 
> I have rewritten Text::Tabs to avoid s//pos/
> The code is at work and I haven't had a chance to test it.
> >From memory, the code for C<sub expand> is below.
> 
> Robin
> 
> sub expand {
> 	my @l;
> 	for ( @_ ) {
> 		my $s = '';
> 		for (split(/^/m, $_, -1)) {
> 			my @tabs = split(/\t/, $_, -1);
> 			my $line = shift @tabs;
> 			for (@tabs) {
> 				my $pad = $tabstop - (length $line) % $tabstop;
> 				$line .= " " x $pad;
> 				$line .= $_;
> 			}
> 			$s .= $line;
> 		}
> 		push(@l, $s);
> 	}
> 	return @l if wantarray;
> 	return $l[0];
> }

Although that's not a huge win unless the work around code goes into a
release on CPAN, which is not something that p5p controls.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About