| 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::Tie::HASH;{ | ||||||||||||||||||||||||||||
| 13 | 2 | our $VERSION = '4.02'; | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use parent 'Mail::Box::Tie'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use Log::Report 'mail-box', import => [ qw/__x warning/ ]; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #-------------------- | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub TIEHASH(@) | ||||||||||||||||||||||||||||
| 26 | 1 | ▶ | { my ($class, $folder) = @_; | ||||||||||||||||||||||||||
|
Subroutine
TIEHASH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 1 | $class->new($folder, 'HASH'); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | #-------------------- | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | #-------------------- | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 139 | ▶ | sub FETCH($) { $_[0]->folder->messageId($_[1]) } | ||||||||||||||||||||||||||
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub STORE($$) | ||||||||||||||||||||||||||||
| 38 | 2 | ▶ | { my ($self, $key, $basicmsg) = @_; | ||||||||||||||||||||||||||
|
Subroutine
STORE: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | ▶ | ! defined $key || $key eq 'undef' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $key or $key eq "undef"
MC/DC0%0/2
not defined $key or $key eq "undef"
not defined $key
$key eq "undef"
Truth table66%2/3
not(A) or B
A= not defined $keyB= $key eq "undef"
| |||||||||||||||||||||||||||||
| 41 | or warning __x"use undef as key, because the message-id of the message is used."; | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 2 | $self->folder->addMessages($basicmsg); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | sub FIRSTKEY() | ||||||||||||||||||||||||||||
| 48 | 6 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
FIRSTKEY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 49 | 6 | $self->{MBT_each_index} = 0; | |||||||||||||||||||||||||||
| 50 | 6 | $self->NEXTKEY(); | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | sub NEXTKEY($) | ||||||||||||||||||||||||||||
| 55 | 274 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
NEXTKEY: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 56 | 274 | my $folder = $self->{MBT_folder}; | |||||||||||||||||||||||||||
| 57 | 274 | my $nrmsgs = $folder->messages; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 274 | my $msg; | |||||||||||||||||||||||||||
| 60 | 274 | while(1) | |||||||||||||||||||||||||||
| 61 | 277 | { my $index = $self->{MBT_each_index}++; | |||||||||||||||||||||||||||
| 62 | 277 | ▶ | $index < $nrmsgs or return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | 271 | $msg = $folder->message($index); | |||||||||||||||||||||||||||
| 64 | 271 | ▶ | $msg->isDeleted or last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 268 | $msg->messageId; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | sub EXISTS($) | ||||||||||||||||||||||||||||
| 72 | 0 | ▶ | { my ($self, $msgid) = @_; | ||||||||||||||||||||||||||
|
Subroutine
EXISTS: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 73 | 0 | my $msg = $self->folder->messageId($msgid); | |||||||||||||||||||||||||||
| 74 | 0 | ▶ | defined $msg && ! $msg->isDeleted; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | sub DELETE($) | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | { my ($self, $msgid) = @_; | ||||||||||||||||||||||||||
|
Subroutine
DELETE: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 80 | 0 | $self->folder->messageId($msgid)->delete; | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | sub CLEAR() | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
CLEAR: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 86 | 0 | $_->delete for $self->folder->messages; | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 2 | 1; | |||||||||||||||||||||||||||