| 1 | # This code is part of Perl distribution Mail-Box version 4.02. | ||||||||||||||||||||||||||||||||||||||||||
| 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) 2001-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 Mail::Box::Thread::Node;{ | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | our $VERSION = '4.02'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | ▶ | use parent 'Mail::Reporter'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 4 | ▶ | use Log::Report 'mail-box', import => [ qw/__x error/ ]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 4 | ▶ | use List::Util qw/first/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | sub new(@) | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 150 | ▶ | { my ($class, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 150 | (bless {}, $class)->init(\%args); | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | sub init($) | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 150 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 150 | ▶ | if(my $message = $args->{message}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 135 | { push @{$self->{MBTN_messages}}, $message; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 135 | ▶ | $self->{MBTN_msgid} = $args->{msgid} || $message->messageId; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'msgid'} || $message->messageId
MC/DC0%0/2
$args->{'msgid'} || $message->messageId
$args->{'msgid'}
$message->messageId
Truth table33%1/3
A || B
A= $args->{'msgid'}B= $message->messageId
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | elsif(my $msgid = $args->{msgid}) | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 15 | { $self->{MBTN_msgid} = $msgid; | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | else | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | { error __x"thread node needs a message object or msgid."; | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 150 | $self->{MBTN_dummy_type} = $args->{dummy_type}; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 150 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | sub isDummy() | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 202 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isDummy: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 202 | my $msgs = $self->{MBTN_messages}; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 202 | ▶ | ! defined $msgs || ! @$msgs || $msgs->[0]->isDummy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $msgs && @$msgs
MC/DC50%1/2
defined $msgs && @$msgs
defined $msgs
@$msgs
Truth table66%2/3
A && B
A= defined $msgsB= @$msgs
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 659 | ▶ | sub messageId() { $_[0]->{MBTN_msgid} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
messageId: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | sub message() | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 504 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
message: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 504 | ▶ | my $messages = $self->{MBTN_messages} ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"MBTN_messages"} ||= []
MC/DC100%1/1
$self->{"MBTN_messages"} ||= []
$self->{"MBTN_messages"}
Truth table100%2/2
A
A= $self->{"MBTN_messages"}
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 504 | ▶ | unless(@$messages) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 10 | ▶ | { return () if wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 10 | my $dummy = $self->{MBTN_dummy_type}->new(messageId => $self->{MBTN_msgid}); | |||||||||||||||||||||||||||||||||||||||||
| 71 | 10 | push @$messages, $dummy; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 10 | return $dummy; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 494 | ▶ | return @$messages if wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 351 | ▶ | (first { ! $_->isDeleted } @$messages) // $messages->[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.6
Condition33%1/3
&first(sub {
not $_->isDeleted;
}
, @$messages) // $messages->[0]
MC/DC0%0/2
&first(sub {
not $_->isDeleted;
}
, @$messages) // $messages->[0]
&first(sub {
not $_->isDeleted;
}
, @$messages)
$messages->[0]
Truth table33%1/3
A // B
A= &first(sub {
not $_->isDeleted;
}
, @$messages)B= $messages->[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | sub addMessage($) | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | { my ($self, $message) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addMessage: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | return $self->{MBTN_messages} = [ $message ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | if $self->isDummy; | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | push @{$self->{MBTN_messages}}, $message; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $message; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | sub expand(;$) | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 121 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expand: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 121 | ▶ | @_ or return $self->message->label('folded') || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$self->message->label('folded') || 0
MC/DC100%1/1
$self->message->label('folded') || 0
$self->message->label('folded')
Truth table100%2/2
A
A= $self->message->label('folded')
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | my $fold = not shift; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | $_->label(folded => $fold) for $self->message; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | $fold; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | # compatibility <2.0 | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 121 | ▶ | sub folded(;$) { my $s = shift; @_ ? $s->expand(not $_[0]) : $s->expand } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
folded: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | sub repliedTo() | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 310 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
repliedTo: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 310 | ▶ | wantarray ? ($self->{MBTN_parent}, $self->{MBTN_quality}) : $self->{MBTN_parent}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | sub follows($$) | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 138 | ▶ | { my ($self, $thread, $how) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
follows: called CC=11 SCAR=25.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 138 | my $quality = $self->{MBTN_quality}; | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | # Do not create cyclic constructs caused by erroneous refs. | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 138 | my $msgid = $self->messageId; # Look up for myself, upwards in thread | |||||||||||||||||||||||||||||||||||||||||
| 118 | 138 | ▶ | for(my $walker = $thread; defined $walker; $walker = $walker->repliedTo) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 205 | ▶ | { return undef if $walker->messageId eq $msgid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 138 | my $threadid = $thread->messageId; # a->b and b->a (ref order reversed) | |||||||||||||||||||||||||||||||||||||||||
| 123 | 138 | foreach ($self->followUps) | |||||||||||||||||||||||||||||||||||||||||
| 124 | 38 | ▶ | { return undef if $_->messageId eq $threadid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | # Register | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 138 | ▶ | if($how eq 'REPLY' || !defined $quality) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$how eq "REPLY" or not defined $quality
MC/DC100%2/2
$how eq "REPLY" or not defined $quality
$how eq "REPLY"
not defined $quality
Truth table100%3/3
A or not(B)
A= $how eq "REPLY"B= not defined $quality
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 74 | { $self->{MBTN_parent} = $thread; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 74 | $self->{MBTN_quality} = $how; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 74 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 64 | ▶ | return $self if $quality eq 'REPLY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 8 | ▶ | if($how eq 'REFERENCE' || ($how eq 'GUESS' && $quality ne 'REFERENCE')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$how eq "REFERENCE" or $how eq "GUESS" and $quality ne "REFERENCE"
$how eq "GUESS" and $quality ne "REFERENCE"
MC/DC0%0/3
$how eq "REFERENCE" or $how eq "GUESS" and $quality ne "REFERENCE"
$how eq "REFERENCE"
$how eq "GUESS"
$quality ne "REFERENCE"
Truth table25%1/4
A or B and C
A= $how eq "REFERENCE"B= $how eq "GUESS"C= $quality ne "REFERENCE"
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 8 | { $self->{MBTN_parent} = $thread; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 8 | $self->{MBTN_quality} = $how; | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 8 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | sub followedBy(@) | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 138 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
followedBy: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 138 | $self->{MBTN_followUps}{$_->messageId} = $_ for @_; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 138 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | sub followUps() | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 337 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
followUps: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 337 | ▶ | $self->{MBTN_followUps} ? values %{$self->{MBTN_followUps}} : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | sub sortedFollowUps() | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 119 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sortedFollowUps: called CC=3 SCAR=11.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 119 | ▶ | my $prepare = shift || sub { $_[0]->startTimeEstimate || 0 }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=8.4
Branch: 1 branch
Condition33%1/3
shift() || sub {
$_[0]->startTimeEstimate or 0;
}
MC/DC0%0/2
shift() || sub {
$_[0]->startTimeEstimate or 0;
}
shift()
sub {
$_[0]->startTimeEstimate or 0;
}
Truth table33%1/3
A || B
A= shift()B= sub {
$_[0]->startTimeEstimate or 0;
}
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 119 | ▶ | my $compare = shift || sub { $_[0] <=> $_[1]}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.6
Condition33%1/3
shift() || sub {
$_[0] <=> $_[1];
}
MC/DC0%0/2
shift() || sub {
$_[0] <=> $_[1];
}
shift()
sub {
$_[0] <=> $_[1];
}
Truth table33%1/3
A || B
A= shift()B= sub {
$_[0] <=> $_[1];
}
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 119 | my %value = map +($prepare->($_) => $_), $self->followUps; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 119 | map $value{$_}, sort { $compare->($a, $b) } keys %value; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | sub threadToString(;$$$) # two undocumented parameters for layout args | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 119 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
threadToString: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 119 | ▶ | my $code = shift || sub { $_[0]->head->study('subject') }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
shift() || sub {
$_[0]->head->study('subject');
}
MC/DC0%0/2
shift() || sub {
$_[0]->head->study('subject');
}
shift()
sub {
$_[0]->head->study('subject');
}
Truth table66%2/3
A || B
A= shift()B= sub {
$_[0]->head->study('subject');
}
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 119 | ▶ | my ($first, $other) = (shift || '', shift || ''); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
shift() || ''
shift() || ''
MC/DC100%1/1
shift() || ''
shift()
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 119 | my $message = $self->message; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 119 | my @follows = $self->sortedFollowUps; | |||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 119 | my @out; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 119 | ▶ | if($self->folded) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | { my $text = $code->($message) || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
&$code($message) || ''
MC/DC0%0/1
&$code($message) || ''
&$code($message)
Truth table50%1/2
A
A= &$code($message)
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | chomp $text; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | return " $first [" . $self->nrMessages . "] $text\n"; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | elsif($message->isDummy) | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 13 | ▶ | { $first .= $first ? '-*-' : ' *-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 13 | ▶ | return (shift @follows)->threadToString($code, $first, "$other " ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | if @follows==1; | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 7 | ▶ | push @out, (shift @follows)->threadToString($code, $first, "$other | " ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | while @follows > 1; | ||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | else | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 105 | ▶ | { my $text = $code->($message) || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
&$code($message) || ''
MC/DC100%1/1
&$code($message) || ''
&$code($message)
Truth table100%2/2
A
A= &$code($message)
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 105 | chomp $text; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 105 | my $size = $message->shortSize; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 105 | @out = "$size$first $text\n"; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 105 | ▶ | push @out, (shift @follows)->threadToString($code, "$other |-", "$other | " ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | while @follows > 1; | ||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 112 | ▶ | push @out, (shift @follows)->threadToString($code, "$other `-","$other " ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | if @follows; | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 112 | join '', @out; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | sub startTimeEstimate() | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 130 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
startTimeEstimate: called CC=6 SCAR=18.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 130 | ▶ | $self->isDummy or return $self->message->timestamp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 10 | my $earliest; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 10 | foreach ($self->followUps) | |||||||||||||||||||||||||||||||||||||||||
| 213 | 14 | { my $stamp = $_->startTimeEstimate; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 14 | ▶ | $earliest = $stamp if !defined $earliest || (defined $stamp && $stamp < $earliest); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not defined $earliest or defined $stamp and $stamp < $earliest
defined $stamp and $stamp < $earliest
MC/DC33%1/3
not defined $earliest or defined $stamp and $stamp < $earliest
not defined $earliest
defined $stamp
$stamp < $earliest
Truth table50%2/4
not(A) or B and C
A= not defined $earliestB= defined $stampC= $stamp < $earliest
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 10 | $earliest; | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | sub endTimeEstimate() | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
endTimeEstimate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $latest; | |||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | $self->recurse( sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | return 1 if $node->isDummy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $stamp = $node->message->timestamp; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $latest = $stamp if !$latest || $stamp > $latest; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $latest or $stamp > $latest
MC/DC0%0/2
not $latest or $stamp > $latest
not $latest
$stamp > $latest
Truth table0%0/3
not(A) or B
A= not $latestB= $stamp > $latest
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $latest; | |||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | sub recurse($) | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 70 | ▶ | { my ($self, $code) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recurse: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 70 | ▶ | $code->($self) or return $self; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | $_->recurse($code) or last | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 70 | ▶ | for $self->followUps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 70 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | sub totalSize() | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
totalSize: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $total = 0; | |||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | $self->recurse(sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my @msgs = shift->messages; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | $total += $msgs[0]->size if @msgs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $total; | |||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | sub numberOfMessages() | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 29 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
numberOfMessages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 29 | my $total = 0; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 29 | ▶ | $self->recurse( sub { $_[0]->isDummy or ++$total; 1 } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 29 | $total; | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | ▶ | sub nrMessages() { $_[0]->numberOfMessages } # compatibility | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nrMessages: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | sub threadMessages() | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 3 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
threadMessages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 3 | my @messages; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 6 | ▶ | $self->recurse( sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 6 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||
| 278 | 6 | ▶ | push @messages, $node->message unless $node->isDummy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 3 | }); | |||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 3 | @messages; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | sub ids() | ||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ids: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my @ids; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | $self->recurse( sub { push @ids, $_[0]->messageId } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | @ids; | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||