[sf-perl] getting the salutations out of an email.
David Muir Sharnoff
sfpug at dave.sharnoff.org
Thu Oct 4 09:39:03 PDT 2012
I suggest you split the message on "\n\n", wrap each fragment separately
and then re-join them.
-Dave
On Thu, Oct 4, 2012 at 9:09 AM, George Hartzell <hartzell at alerce.com> wrote:
> Richard Reina writes:
> > I have a text files that need to be word wrapped neatly so they can be
> > turned into emails. They consist of:
> >
> > Dear (or Hello) Jim,
> >
> > Nice meeting with you on Thursday. Blah
> > blah, blah.
> > blah, blah, blah,
> >
> > Thanks,
> >
> > Richard
> >
> > Text::Wrap does a great job in breaking up and wrapping the lines my
> > problem is that since it removes all the "\n" s
> > I end up with:
> >
> > Dear Jim, Nice meeting with you on Thursday. Blah
> > blah, blah.
> > blah, blah, blah, Thanks, Richard
> >
> > To counter this I began writing various conditionals that try to guess
> the
> > first and last lines of the file so that they can be preserved
> separately
> > and added after Text::Wrap has done it's work. However, it's very
> > convoluted and I am not so confident it will work. So I am wondering if
> > anyone know of a better way to accomplish the task?
>
> At the simple end of the spectrum, how about just running the message
> text through fmt (/usr/bin/fmt on mac os and freebsd).
>
> At the other end of the spectrum, how about using Markdown in the
> source text file and then running it through a converter. That'll
> open the entire world of Email-MIME-Kit
> (http://search.cpan.org/dist/Email-MIME-Kit/).
>
> g.
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20121004/885e2116/attachment.html>
More information about the SanFrancisco-pm
mailing list