Message/Convert/HtmlFormatText.pm

filter: Statementstmt 100% 31 / 31 Branchbran n/a Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 50.0% 1 / 2 totaltotal 89.5% 43 / 48 SCAR 11.0
CC
3
Cov
94%
init
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Message/TransferEnc/QuotedPrint.pm ↑ Summary Message/Field/DKIM.pm »
1 # Copyrights 2001-2023 by [Mark Overmeer <markov@cpan.org>].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.03.
5 # This code is part of distribution Mail-Message. Meta-POD processed with
6 # OODoc into POD and HTML manual-pages. See README.md
7 # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8  
9 package Mail::Message::Convert::HtmlFormatText;
10 2 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 $VERSION = '3.013';
12  
13 2 ▶use base 'Mail::Message::Convert';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 ▶use Mail::Message::Body::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use HTML::TreeBuilder;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use HTML::FormatText;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23  
24 sub init($)
25 2 ▶{ my ($self, $args) = @_;
Subroutine init: called CC=3 SCAR=11.4
Pod undocumented
26  
27 2 $self->SUPER::init($args);
28  
29 $self->{MMCH_formatter} = HTML::FormatText->new
30 ( leftmargin => $args->{leftmargin} // 3,
31 2 ▶ , rightmargin => $args->{rightmargin} // 72,
Condition50%2/4
$args->{"leftmargin"} // 3
l!l
02
$args->{"rightmargin"} // 72
l!l
02
MC/DC0%0/1
$args->{"leftmargin"} // 3
$args->{"leftmargin"}
MC/DC0%0/1
$args->{"rightmargin"} // 72
$args->{"rightmargin"}
Truth table50%1/2
A
A= $args->{"leftmargin"}
Aresult
11
00
Truth table50%1/2
A
A= $args->{"rightmargin"}
Aresult
11
00
32 );
33
34 2 $self;
35 }
36  
37 #------------------------------------------
38  
39  
40 sub format($)
41 2 ▶{ my ($self, $body) = @_;
Subroutine format: called CC=1 SCAR=0.0
Pod documented
42  
43 2 my $dec = $body->encode(transfer_encoding => 'none');
44 2 my $tree = HTML::TreeBuilder->new_from_file($dec->file);
45  
46 (ref $body)->new
47 ( based_on => $body
48 , mime_type => 'text/plain'
49 , charset => 'iso-8859-1'
50 2 , data => [ $self->{MMCH_formatter}->format($tree) ]
51 );
52 }
53  
54 #------------------------------------------
55  
56 2 1;
« Message/TransferEnc/QuotedPrint.pm ↑ Summary Message/Field/DKIM.pm »