File Coverage

blib/lib/HTML/FromMail/Object.pm
Criterion Covered Total %
statement 12 30 40.0
branch 0 6 0.0
condition 0 5 0.0
subroutine 4 8 50.0
pod 3 4 75.0
total 19 53 35.8


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::Object;{
13             our $VERSION = '4.00';
14             }
15              
16 1     1   8 use base 'Mail::Reporter';
  1         1  
  1         592  
17              
18 1     1   587 use strict;
  1         1  
  1         16  
19 1     1   3 use warnings;
  1         1  
  1         35  
20              
21 1     1   4 use Log::Report 'html-frommail';
  1         2  
  1         3  
22              
23             #--------------------
24              
25             sub init($)
26 0     0 0   { my ($self, $args) = @_;
27 0           $self->SUPER::init($args);
28              
29 0   0       $self->{HFO_topic} = $args->{topic} // panic "No topic";
30 0   0       $self->{HFO_settings} = $args->{settings} || {};
31 0           $self;
32             }
33              
34             #--------------------
35              
36 0     0 1   sub topic() { $_[0]->{HFO_topic} }
37              
38              
39             sub settings(;$)
40 0     0 1   { my $self = shift;
41 0 0         my $topic = @_ ? shift : $self->topic;
42 0 0         defined $topic or return {};
43 0 0         $self->{HFO_settings}{$topic} || {};
44             }
45              
46             #--------------------
47              
48             sub plain2html($)
49 0     0 1   { my $self = shift;
50 0           my $string = join '', @_;
51 0           for($string)
52 0           { s/\&/\&/g;
53 0           s/\
54 0           s/\>/\>/g;
55 0           s/"/\"/g;
56             }
57 0           $string;
58             }
59              
60             1;