File Coverage

blib/lib/HTML/FromMail/Default/HTMLifiers.pm
Criterion Covered Total %
statement 12 17 70.5
branch 0 4 0.0
condition 0 2 0.0
subroutine 4 5 80.0
pod 1 1 100.0
total 17 29 58.6


line stmt bran cond sub pod time code
1             # This code is part of Perl distribution HTML-FromMail version 4.00.
2             # The POD got stripped from this file by OODoc version 3.05.
3             # For contributors see file ChangeLog.
4              
5             # This software is copyright (c) 2003-2025 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 HTML::FromMail::Default::HTMLifiers;{
13             our $VERSION = '4.00';
14             }
15              
16              
17 1     1   330250 use strict;
  1         2  
  1         46  
18 1     1   5 use warnings;
  1         1  
  1         55  
19              
20 1     1   563 use Log::Report 'html-frommail';
  1         75876  
  1         3  
21              
22 1     1   1116 use HTML::FromText ();
  1         5943  
  1         134  
23              
24             #--------------------
25              
26             our @htmlifiers = (
27             'text/plain' => \&htmlifyText,
28             # 'text/html' => \&htmlifyHtml,
29             );
30              
31              
32             sub htmlifyText($$$$)
33 0     0 1   { my ($page, $message, $part, $args) = @_;
34 0 0         my $main = $args->{main} or panic;
35 0   0       my $settings = $main->settings('HTML::FromText')
36             || +{ pre => 1, urls => 1, email => 1, bold => 1, underline => 1};
37              
38 0 0         my $f = HTML::FromText->new($settings)
39             or panic "cannot create an HTML::FromText object";
40              
41 0           +{ image => '', # this is not an image
42             html => { text => $f->parse($part->decoded->string) },
43             };
44             }
45              
46              
47             1;