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:
Robin Barker
Date:
March 28, 2008 15:58
Subject:
RE: [perl #52104] Text::Wrap::wrap() generates a segfault with Cyrillic characters when the utf8 flag is turned on
Message ID:
46A0F33545E63740BC7563DE59CA9C6D08EB61@exchsvr2.npl.ad.local
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];
}









-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Serco House, 16 Bartley Wood Business Park,
                   Hook, Hampshire, United Kingdom  RG27 9UY
-------------------------------------------------------------------

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