| 1 | # This code is part of Perl distribution Mail-Message version 4.05. | ||
| 2 | # The POD got stripped from this file by OODoc version 3.06. | ||
| 3 | # For contributors see file ChangeLog. | ||
| 4 | |||
| 5 | # This software is copyright (c) 2001-2026 by Mark Overmeer. | ||
| 6 | |||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||
| 10 | |||
| 11 | |||
| 12 | package Mail::Message::Convert::TextAutoformat;{ | ||
| 13 | our $VERSION = '4.05'; | ||
| 14 | } | ||
| 15 | |||
| 16 | use parent 'Mail::Message::Convert'; | ||
| 17 | |||
| 18 | use strict; | ||
| 19 | use warnings; | ||
| 20 | |||
| 21 | use Log::Report 'mail-message', import => [ qw// ]; | ||
| 22 | |||
| 23 | use Text::Autoformat qw/autoformat/; | ||
| 24 | |||
| 25 | use Mail::Message::Body::String (); | ||
| 26 | |||
| 27 | #-------------------- | ||
| 28 | |||
| 29 | sub init($) | ||
| 30 | { my ($self, $args) = @_; | ||
| 31 | $self->SUPER::init($args); | ||
| 32 | |||
| 33 | $self->{MMCA_options} = $args->{autoformat} || +{ all => 1 }; | ||
| 34 | $self; | ||
| 35 | } | ||
| 36 | |||
| 37 | #-------------------- | ||
| 38 | |||
| 39 | sub autoformatBody($) | ||
| 40 | { my ($self, $body) = @_; | ||
| 41 | (ref $body)->new(based_on => $body, data => autoformat($body->string, $self->{MMCA_options})); | ||
| 42 | } | ||
| 43 | |||
| 44 | 1; |