Text::Wrap::wrap difference

# Article reposted ... I cancelled it when I thought I had figured out
# the answer ...

I have moved from a Solaris box (running perl 5.6.0) to an Intel Linux
box (running perl 5.8.0).

I have a script that processes msgs I get from certain mailing lists
(which procmail kindly puts into files for me). It wordwraps the msgs
(since some of them have ridiculously long lines) and replaces certain
encoded chars by their plain text equivalents. It looks like this

I don't see anything in your s/// that would be subject to a version
change. Could the behavior of Text::Wrap have changed? wrap() is
only advertised as a paragraph formatter, which makes it rather uncommitted
to empty lines.

If it's not that, it must be some unicode devilry. That works well
as an explanation of the inexplicable.

The substitution sequence could be greatly simplified. Most are single-
character substitutions, a single tr/// can do them all. Some are character
deletions, which another tr/// can do. What remains are substitutions
of single characters with either "--" or "...". Two s/// with character
classes on the regex side can do those.
>
> I would appreciate suggestions for making this work on the Linux box.

Deal with empty lines explicitly. I don't know Text::Wrap very well,
but they do mark an end-of-paragraph. Someone who does know Text::Wrap
may have a better idea.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!