| 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::Format::OODoc;{ | ||||||||||||||||||||
| 13 | 1 | our $VERSION = '4.00'; | |||||||||||||||||||
| 14 | } | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | ▶ | use base 'HTML::FromMail::Format'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 1 | ▶ | use Log::Report 'html-frommail'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | ▶ | use OODoc::Template (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | #-------------------- | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | #----------- | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 0 | ▶ | sub oodoc() { $_[0]->{HFFM_oodoc} } | ||||||||||||||||||
|
Subroutine
oodoc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | #----------- | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | sub expand($$$$) | ||||||||||||||||||||
| 34 | 0 | ▶ | { my ($self, $args, $tag, $attrs, $textref) = @_; | ||||||||||||||||||
|
Subroutine
expand: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | # Lookup the method to be called. | ||||||||||||||||||||
| 37 | 0 | my $method = 'html' . ucfirst($tag); | |||||||||||||||||||
| 38 | 0 | my $prod = $args->{producer}; | |||||||||||||||||||
| 39 | 0 | ▶ | $prod->can($method) or return undef; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 0 | my %info = (%$args, %$attrs, textref => $textref); | |||||||||||||||||||
| 42 | 0 | $prod->$method($args->{object}, \%info); | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | sub export($@) | ||||||||||||||||||||
| 47 | 0 | ▶ | { my ($self, $message, %args) = @_; | ||||||||||||||||||
|
Subroutine
export: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | my $oodoc = $self->{HFFM_oodoc} = OODoc::Template->new; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | my $output = $args{output}; | |||||||||||||||||||
| 52 | 0 | ▶ | open my($out), ">", $output | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 53 | or fault __x"cannot write to {out}"; | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 0 | my $input = $args{input}; | |||||||||||||||||||
| 56 | 0 | ▶ | open my($in), "<", $input | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 57 | or fault __x"cannot open template file {in}", in => $input; | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | 0 | my $template = join '', <$in>; | |||||||||||||||||||
| 60 | 0 | close $in; | |||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | my %defaults = ( | ||||||||||||||||||||
| 63 | 0 | ▶ | DYNAMIC => sub { $self->expand(\%args, @_) }, | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 64 | 0 | ); | |||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 0 | my $oldout = select $out; | |||||||||||||||||||
| 67 | 0 | $oodoc->parse($template, \%defaults); | |||||||||||||||||||
| 68 | 0 | select $oldout; | |||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 0 | close $out; | |||||||||||||||||||
| 71 | 0 | $self; | |||||||||||||||||||
| 72 | } | ||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | sub containerText($) | ||||||||||||||||||||
| 75 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||
|
Subroutine
containerText: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 76 | 0 | my $textref = $args->{textref}; | |||||||||||||||||||
| 77 | 0 | ▶ | defined $textref ? $$textref : undef; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | sub processText($$) | ||||||||||||||||||||
| 81 | 0 | ▶ | { my ($self, $text, $args) = @_; | ||||||||||||||||||
|
Subroutine
processText: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 82 | 0 | $self->oodoc->parse($text, {}); | |||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | sub lookup($$) | ||||||||||||||||||||
| 86 | 0 | ▶ | { my ($self, $what, $args) = @_; | ||||||||||||||||||
|
Subroutine
lookup: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 87 | 0 | $self->oodoc->valueFor($what); | |||||||||||||||||||
| 88 | } | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | sub onFinalToken($) | ||||||||||||||||||||
| 91 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||
|
Subroutine
onFinalToken: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 92 | 0 | ▶ | not (defined $args->{textref} && defined ${$args->{textref}}); | ||||||||||||||||||
|
Condition0%0/3
defined $args->{'textref'} && defined ${$$args{'textref'};}
MC/DC0%0/2
defined $args->{'textref'} && defined ${$$args{'textref'};}
defined $args->{'textref'}
defined ${$$args{'textref'};}
Truth table0%0/3
A && B
A= defined $args->{'textref'}B= defined ${$$args{'textref'};}
| |||||||||||||||||||||
| 93 | } | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 1 | 1; | |||||||||||||||||||