Ricardo SIGNES > MIME-BodyMunger-0.004 > MIME::BodyMunger

Download:
MIME-BodyMunger-0.004.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.004   Source   Latest Release: MIME-BodyMunger-0.006

NAME ^

MIME::BodyMunger - rewrite the content of text parts, minding charset

VERSION ^

version 0.004

SYNOPSIS ^

  MIME::BodyMunger->rewrite_content(
    $mime_entity,
    sub {
      my ($body_ref) = @_;
      $$body_ref =~ s/zig/zag/;
    },
  );

DESCRIPTION ^

MIME::BodyMunger provides methods for rewriting text parts. These methods take care of character sets for you so that you can treat everything like text instead of worrying about content transfer encoding or character set encoding.

At present, only MIME::Entity messages can be handled. Other types will be added in the future.

METHODS ^

rewrite_content

  MIME::BodyMunger->rewrite_content($message, sub { ... });

This method uses the given callback to rewrite the content (body) of the message. It decodes the content (using Content-Transfer-Encoding and the Content-Type charset (or ISO-8859-1, if none is given)) and provides a reference to the character string to the coderef. If the content is altered, the body will be re-encoded into the original charset and the message will be updated.

The callback is invoked like this:

  $code->(\$content, $message);

In the future, there should be an option to re-encode to an alternate charset.

rewrite_lines

  MIME::BodyMunger->rewrite_lines($message, sub { ... });

This method behaves like rewrite_content, but the callback is invoked once per line, like this:

  local $_ = $line;
  $code->($message);

If any line is changed, the entire body will be reencoded and updated.

AUTHOR ^

Ricardo SIGNES, <rjbs@cpan.org>

THANKS ^

Thanks to Pobox.com and Listbox.com, who sponsored the development of this module.

Thanks to Brian Cassidy for writing some tests for the initial release.

BUGS ^

Please report any bugs or feature requests through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT ^

Copyright 2008, Ricardo SIGNES. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: