| 1 | # This code is part of Perl distribution Log-Report version 1.46. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 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) 2007-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 Log::Report::Message;{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 17 | our $VERSION = '1.46'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 17 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 17 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 17 | ▶ | use Log::Report 'log-report', import => [ qw/textdomain/ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 17 | ▶ | use POSIX qw/locale_h/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 17 | ▶ | use List::Util qw/first/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 17 | ▶ | use Scalar::Util qw/blessed/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 17 | ▶ | use Log::Report::Util qw/to_html/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # Work-around for missing LC_MESSAGES on old Perls and Windows | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 17 | ▶ | { no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 17 | eval "&LC_MESSAGES"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 17 | ▶ | *LC_MESSAGES = sub(){5} if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 17 | ▶ | '""' => 'toString', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | ▶ | '&{}' => sub { my $obj = shift; sub{$obj->clone(@_)} }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 17 | '.' => 'concat', | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 17 | fallback => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | sub new($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 156 | ▶ | { my ($class, %s) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=15 SCAR=28.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 156 | ▶ | if(ref $s{_count}) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | { my $c = $s{_count}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | $s{_count} = ref $c eq 'ARRAY' ? @$c : keys %$c; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 156 | ▶ | $s{_join} //= $"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$s{"_join"} //= $"
MC/DC0%0/2
$s{"_join"} //= $"
$s{"_join"}
$"
Truth table66%2/3
A //= B
A= $s{"_join"}B= $"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 156 | ▶ | if($s{_msgid}) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | { $s{_append} = defined $s{_append} ? $1.$s{_append} : $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 143 | ▶ | if $s{_msgid} =~ s/(\s+)$//s; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | $s{_prepend}.= $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 143 | ▶ | if $s{_msgid} =~ s/^(\s+)//s; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 156 | ▶ | if($s{_plural}) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 20 | { s/\s+$//, s/^\s+// for $s{_plural}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 156 | ▶ | my $tags = delete $s{_tag} // delete $s{_tags} // delete $s{_class} // delete $s{_classes}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
((delete $s{"_tag"} // delete $s{"_tags"}) // delete $s{"_class"}) // delete $s{"_classes"}
(delete $s{"_tag"} // delete $s{"_tags"}) // delete $s{"_class"}
delete $s{"_tag"} // delete $s{"_tags"}
MC/DC25%1/4
((delete $s{"_tag"} // delete $s{"_tags"}) // delete $s{"_class"}) // delete $s{"_classes"}
delete $s{"_tag"}
delete $s{"_tags"}
delete $s{"_class"}
delete $s{"_classes"}
Truth table40%2/5
A // B // C // D
A= delete $s{"_tag"}B= delete $s{"_tags"}C= delete $s{"_class"}D= delete $s{"_classes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 156 | ▶ | $s{_tags} = ref $tags eq 'ARRAY' ? $tags : [ split /[,\s]+/, $tags ] if defined $tags; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 156 | bless \%s, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # internal use only: to simplify __*p* functions | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub _msgctxt($) { $_[0]->{_msgctxt} = $_[1]; $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_msgctxt: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | sub clone(@) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | (ref $self)->new(%$self, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 2 | ▶ | sub prepend() { $_[0]->{_prepend}} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepend: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 115 | ▶ | sub msgid() { $_[0]->{_msgid} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 5 | ▶ | sub append() { $_[0]->{_append} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 32 | ▶ | sub domain() { $_[0]->{_domain} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
domain: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub count() { $_[0]->{_count} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
count: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub context() { $_[0]->{_context}} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
context: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub msgctxt() { $_[0]->{_msgctxt}} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgctxt: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 12 | ▶ | sub tags() { @{$_[0]->{_tags} || []} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tags: called CC=2 SCAR=7.2
Pod
documented
Condition50%1/2
$_[0]{'_tags'} || []
MC/DC0%0/1
$_[0]{'_tags'} || []
$_[0]{'_tags'}
Truth table50%1/2
A
A= $_[0]{'_tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 17 | *classes = \&tags; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub addTags() { push @{shift->{_tags}}, @_ } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addTags: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | sub to(;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 20 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 20 | ▶ | @_ ? $self->{_to} = shift : $self->{_to}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | sub errno(;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 17 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
errno: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 17 | ▶ | @_ ? $self->{_errno} = shift : $self->{_errno}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 3 | ▶ | sub valueOf($) { $_[0]->{$_[1]} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valueOf: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | sub taggedWith($) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 10 | ▶ | { my ($self, $match) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
taggedWith: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 10 | ▶ | ref $match eq 'Regexp' ? (first { $_ =~ $$match } $self->tags) : (first { $_ eq $match } $self->tags); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 17 | *inClass = \&taggedWith; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | sub toString(;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 117 | ▶ | { my ($self, $locale) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toString: called CC=21 SCAR=35.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 117 | ▶ | my $count = $self->{_count} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'_count'} || 0
MC/DC100%1/1
$self->{'_count'} || 0
$self->{'_count'}
Truth table100%2/2
A
A= $self->{'_count'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 117 | ▶ | $locale = $self->{_lang} if $self->{_lang}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 117 | ▶ | my $prepend = $self->{_prepend} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"_prepend"} // ""
MC/DC100%1/1
$self->{"_prepend"} // ""
$self->{"_prepend"}
Truth table100%2/2
A
A= $self->{"_prepend"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 117 | ▶ | my $append = $self->{_append} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"_append"} // ""
MC/DC100%1/1
$self->{"_append"} // ""
$self->{"_append"}
Truth table100%2/2
A
A= $self->{"_append"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 117 | ▶ | $prepend = $prepend->isa(__PACKAGE__) ? $prepend->toString($locale) : "$prepend" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | if blessed $prepend; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 117 | ▶ | $append = $append->isa(__PACKAGE__) ? $append->toString($locale) : "$append" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | if blessed $append; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | $self->{_msgid} # no translation, constant string | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 117 | ▶ | or return "$prepend$append"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # assumed is that switching locales is expensive | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 100 | my $oldloc = setlocale(LC_MESSAGES); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 100 | ▶ | setlocale(LC_MESSAGES, $locale) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
defined $locale and !defined($oldloc) || $locale ne $oldloc
not defined $oldloc or $locale ne $oldloc
MC/DC0%0/3
defined $locale and !defined($oldloc) || $locale ne $oldloc
defined $locale
not defined $oldloc
$locale ne $oldloc
Truth table25%1/4
A and not(B) or C
A= defined $localeB= not defined $oldlocC= $locale ne $oldloc
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | if defined $locale && (!defined $oldloc || $locale ne $oldloc); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # translate the msgid | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 100 | my $domain = $self->{_domain}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | blessed $domain && $domain->isa('Log::Report::Minimal::Domain') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 100 | ▶ | or $domain = $self->{_domain} = textdomain $domain; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($domain) and $domain->isa("Log::Report::Minimal::Domain")
MC/DC50%1/2
builtin::blessed($domain) and $domain->isa("Log::Report::Minimal::Domain")
builtin::blessed($domain)
$domain->isa("Log::Report::Minimal::Domain")
Truth table66%2/3
A and B
A= builtin::blessed($domain)B= $domain->isa("Log::Report::Minimal::Domain")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 100 | ▶ | my $format = $domain->translate($self, $locale || $oldloc) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$domain->translate($self, $locale || $oldloc) // (return ())
$locale || $oldloc
MC/DC0%0/1
$domain->translate($self, $locale || $oldloc) // (return ())
$domain->translate($self, $locale || $oldloc)
MC/DC0%0/2
$locale || $oldloc
$locale
$oldloc
Truth table50%1/2
A
A= $domain->translate($self, $locale || $oldloc)
Truth table33%1/3
A || B
A= $localeB= $oldloc
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | // return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # fill-in the fields | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 100 | ▶ | my $text = $self->{_expand} ? $domain->interpolate($format, $self) : "$prepend$format$append"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 100 | ▶ | setlocale(LC_MESSAGES, $oldloc) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $oldloc and !defined($locale) || $oldloc ne $locale
not defined $locale or $oldloc ne $locale
MC/DC0%0/3
defined $oldloc and !defined($locale) || $oldloc ne $locale
defined $oldloc
not defined $locale
$oldloc ne $locale
Truth table25%1/4
A and not(B) or C
A= defined $oldlocB= not defined $localeC= $oldloc ne $locale
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | if defined $oldloc && (!defined $locale || $oldloc ne $locale); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 100 | $text; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 17 | my %tohtml = qw/ > gt < lt " quot & amp /; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | sub toHTML(;$) { to_html($_[0]->toString($_[1])) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toHTML: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | sub untranslated() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
untranslated: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | ▶ | ($self->{_prepend} // '') . ($self->{_msgid} // '') . ($self->{_append} // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$self->{"_prepend"} // ""
$self->{"_msgid"} // ""
$self->{"_append"} // ""
MC/DC100%1/1
$self->{"_prepend"} // ""
$self->{"_prepend"}
MC/DC0%0/1
$self->{"_msgid"} // ""
$self->{"_msgid"}
MC/DC0%0/1
$self->{"_append"} // ""
$self->{"_append"}
Truth table100%2/2
A
A= $self->{"_prepend"}
Truth table50%1/2
A
A= $self->{"_msgid"}
Truth table50%1/2
A
A= $self->{"_append"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | sub concat($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 24 | ▶ | { my ($self, $what, $reversed) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
concat: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 24 | ▶ | if($reversed) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 6 | ▶ | { $what .= $self->{_prepend} if defined $self->{_prepend}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 6 | return (ref $self)->new(%$self, _prepend => $what); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 18 | ▶ | $what = $self->{_append} . $what if defined $self->{_append}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 18 | (ref $self)->new(%$self, _append => $what); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | sub freeze() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 4 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
freeze: called CC=11 SCAR=29.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | my %data = %$self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | ▶ | if(my $p = $data{_prepend}) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | { $data{_prepend} = blessed $p && $p->isa(__PACKAGE__) ? $p->freeze(%args) : "$p"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($p) and $p->isa(__PACKAGE__)
MC/DC0%0/2
builtin::blessed($p) and $p->isa(__PACKAGE__)
builtin::blessed($p)
$p->isa(__PACKAGE__)
Truth table0%0/3
A and B
A= builtin::blessed($p)B= $p->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 4 | ▶ | if(my $a = $data{_append}) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | ▶ | { $data{_append} = blessed $a && $a->isa(__PACKAGE__) ? $a->freeze(%args) : "$a"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($a) and $a->isa(__PACKAGE__)
MC/DC0%0/2
builtin::blessed($a) and $a->isa(__PACKAGE__)
builtin::blessed($a)
$a->isa(__PACKAGE__)
Truth table33%1/3
A and B
A= builtin::blessed($a)B= $a->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 4 | ▶ | if(my $d = $data{_domain}) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 4 | ▶ | { $data{_domain} = $d->name if blessed $d && $d->isa('Log::Report::Minimal::Domain'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($d) and $d->isa("Log::Report::Minimal::Domain")
MC/DC50%1/2
builtin::blessed($d) and $d->isa("Log::Report::Minimal::Domain")
builtin::blessed($d)
$d->isa("Log::Report::Minimal::Domain")
Truth table66%2/3
A and B
A= builtin::blessed($d)B= $d->isa("Log::Report::Minimal::Domain")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 4 | ▶ | $data{_lr_version} = $Log::Report::VERSION // '3.14'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Log::Report::VERSION // "3.14"
MC/DC0%0/1
$Log::Report::VERSION // "3.14"
$Log::Report::VERSION
Truth table50%1/2
A
A= $Log::Report::VERSION
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 4 | \%data; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | sub thaw($%) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 4 | ▶ | { my ($class, $data, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
thaw: called CC=5 SCAR=17.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 4 | my %data = %$data; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 4 | ▶ | if(my $p = $data{_prepend}) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | { $data{_prepend} = ref $p eq 'HASH' ? $class->thaw($p, %args) : $p; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 4 | ▶ | if(my $a = $data{_append}) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 2 | ▶ | { $data{_append} = ref $a eq 'HASH' ? $class->thaw($a, %args) : $a; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 4 | delete $data{_lr_version}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 4 | $class->new(%data); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 17 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||