Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

(tye)Re: quoted-printable, and ugly code

by tye (Sage)
on Feb 22, 2001 at 20:20 UTC ( #60232=note: print w/replies, xml ) Need Help??


in reply to quoted-printable, and ugly code

Lots of items already covered here. But I felt compelled to note that s/^\w+:(.*)$/$1/gs nearly makes me cringe (which is silly because it really isn't "bad" at all). First, s/^\w+://gs gets the point across much better, I think. Second, can't headers have "-" in them so don't you want [-\w]+? Third, I'd strip whitespace after the ":". So:

s/^[-\w]+:\s*//gs

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: quoted-printable, and ugly code
by McD (Chaplain) on Feb 23, 2001 at 00:24 UTC
    Better yet, I think you can get both the quoted-printable decoding you want and the mail header parsing you'd like with use MIME::Parser, part of the MIME-tools package.

    And if what you're doing is tinkering with a Perl-based mail filter, check out Mail::Audit.

    Peace,
    -McD

      MIME::Parser is a real heavyweight. MIME::Lite is a good alternative.


      Always keep a song in your heart.
      It's like karaoke for the voices in your head.
        Cool, I hadn't seen that one!

        Of course, the original query had to do with parsing MIME, and MIME::Lite doesn't seem to do that. From the docs:

        MIME::Lite is intended as a simple, standalone module for generating (not parsing!) MIME messages...

        Peace,
        -McD

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://60232]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2023-12-03 17:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (20 votes). Check out past polls.

    Notices?