| 1 | # This code is part of Perl distribution Log-Report-Optional version 1.08. | ||||||||||||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.04. | ||||||||||||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | # This software is copyright (c) 2013-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 | #oodist: *** DO NOT USE THIS VERSION FOR PRODUCTION *** | ||||||||||||||||||||
| 12 | #oodist: This file contains OODoc-style documentation which will get stripped | ||||||||||||||||||||
| 13 | #oodist: during its release in the distribution. You can use this file for | ||||||||||||||||||||
| 14 | #oodist: testing, however the code of this development version may be broken! | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | package Log::Report::Minimal::Domain;{ | ||||||||||||||||||||
| 17 | 4 | our $VERSION = '1.08'; | |||||||||||||||||||
| 18 | } | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 4 | ▶ | use String::Print 'oo'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | #-------------------- | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 6 | ▶ | sub new(@) { my $class = shift; (bless {}, $class)->init({@_}) } | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 29 | sub init($) | ||||||||||||||||||||
| 30 | 6 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 31 | 6 | ▶ | $self->{LRMD_name} = $args->{name} or Log::Report::panic(); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 32 | 6 | $self; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | #-------------------- | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 0 | ▶ | sub name() { $_[0]->{LRMD_name} } | ||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 38 | 0 | ▶ | sub isConfigured() { $_[0]->{LRMD_where} } | ||||||||||||||||||
|
Subroutine
isConfigured: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | sub configure(%) | ||||||||||||||||||||
| 43 | 1 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||
|
Subroutine
configure: called CC=9 SCAR=26.4
Pod
documented
| |||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 1 | ▶ | my $here = $args{where} || [caller]; | ||||||||||||||||||
|
Condition50%1/2
$args{'where'} || [caller]
MC/DC0%0/1
$args{'where'} || [caller]
$args{'where'}
Truth table50%1/2
A
A= $args{'where'}
| |||||||||||||||||||||
| 46 | 1 | ▶ | if(my $s = $self->{LRMD_where}) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 47 | 0 | { my $domain = $self->name; | |||||||||||||||||||
| 48 | 0 | die "only one package can contain configuration; for $domain already in $s->[0] in file $s->[1] line $s->[2]. Now also found at $here->[1] line $here->[2]\n"; | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | 1 | my $where = $self->{LRMD_where} = $here; | |||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | # documented in the super-class, the more useful man-page | ||||||||||||||||||||
| 53 | 1 | ▶ | my $format = $args{formatter} || 'PRINTI'; | ||||||||||||||||||
|
Condition50%1/2
$args{'formatter'} || 'PRINTI'
MC/DC0%0/1
$args{'formatter'} || 'PRINTI'
$args{'formatter'}
Truth table50%1/2
A
A= $args{'formatter'}
| |||||||||||||||||||||
| 54 | 1 | ▶ | $format = {} if $format eq 'PRINTI'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 1 | ▶ | if(ref $format eq 'HASH') | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 57 | 1 | ▶ | { my $class = delete $format->{class} || 'String::Print'; | ||||||||||||||||||
|
Condition50%1/2
delete $format->{'class'} || 'String::Print'
MC/DC0%0/1
delete $format->{'class'} || 'String::Print'
delete $format->{'class'}
Truth table50%1/2
A
A= delete $format->{'class'}
| |||||||||||||||||||||
| 58 | 1 | ▶ | my $method = delete $format->{method} || 'sprinti'; | ||||||||||||||||||
|
Condition50%1/2
delete $format->{'method'} || 'sprinti'
MC/DC0%0/1
delete $format->{'method'} || 'sprinti'
delete $format->{'method'}
Truth table50%1/2
A
A= delete $format->{'method'}
| |||||||||||||||||||||
| 59 | 1 | my $sp = $class->new(%$format); | |||||||||||||||||||
| 60 | 1 | ▶ | $self->{LRMD_format} = sub { $sp->$method(@_) }; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | elsif(ref $format eq 'CODE') | ||||||||||||||||||||
| 63 | 0 | { $self->{LRMD_format} = $format; | |||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | else | ||||||||||||||||||||
| 66 | 0 | { error __x"illegal formatter `{name}' at {fn} line {line}", name => $format, fn => $where->[1], line => $where->[2]; | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 1 | $self; | |||||||||||||||||||
| 70 | } | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | #-------------------- | ||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | sub interpolate(@) | ||||||||||||||||||||
| 75 | 3 | ▶ | { my ($self, $msgid, $args) = @_; | ||||||||||||||||||
|
Subroutine
interpolate: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||
| 76 | 3 | ▶ | $args->{_expand} or return $msgid; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 3 | ▶ | my $f = $self->{LRMD_format} || $self->configure->{LRMD_format}; | ||||||||||||||||||
|
Condition66%2/3
$self->{'LRMD_format'} || $self->configure->{'LRMD_format'}
MC/DC0%0/2
$self->{'LRMD_format'} || $self->configure->{'LRMD_format'}
$self->{'LRMD_format'}
$self->configure->{'LRMD_format'}
Truth table66%2/3
A || B
A= $self->{'LRMD_format'}B= $self->configure->{'LRMD_format'}
| |||||||||||||||||||||
| 79 | 3 | $f->($msgid, $args); | |||||||||||||||||||
| 80 | } | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 4 | 1; | |||||||||||||||||||