line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2023 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.03. |
5
|
|
|
|
|
|
|
# This code is part of distribution Mail-Box. Meta-POD processed with |
6
|
|
|
|
|
|
|
# OODoc into POD and HTML manual-pages. See README.md |
7
|
|
|
|
|
|
|
# Copyright Mark Overmeer. Licensed under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Mail::Box::Tie::HASH; |
10
|
2
|
|
|
2
|
|
1415
|
use vars '$VERSION'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
104
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.010'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
40
|
|
15
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
62
|
|
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1110
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub TIEHASH(@) |
21
|
1
|
|
|
1
|
|
566
|
{ my ($class, $folder) = @_; |
22
|
1
|
50
|
33
|
|
|
15
|
croak "No folder specified to tie to." |
23
|
|
|
|
|
|
|
unless ref $folder && $folder->isa('Mail::Box'); |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
6
|
bless { MBT_folder => $folder, MBT_type => 'HASH' }, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#------------------------------------------- |
29
|
|
|
|
|
|
|
|
30
|
139
|
|
|
139
|
|
24450
|
sub FETCH($) { shift->{MBT_folder}->messageId(shift) } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub STORE($$) |
34
|
2
|
|
|
2
|
|
85604
|
{ my ($self, $key, $basicmsg) = @_; |
35
|
|
|
|
|
|
|
|
36
|
2
|
50
|
66
|
|
|
16
|
carp "Use undef as key, because the message-id of the message is used." |
37
|
|
|
|
|
|
|
if defined $key && $key ne 'undef'; |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
30
|
$self->{MBT_folder}->addMessages($basicmsg); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub FIRSTKEY() |
44
|
6
|
|
|
6
|
|
185
|
{ my $self = shift; |
45
|
6
|
|
|
|
|
14
|
my $folder = $self->{MBT_folder}; |
46
|
|
|
|
|
|
|
|
47
|
6
|
|
|
|
|
8
|
$self->{MBT_each_index} = 0; |
48
|
6
|
|
|
|
|
17
|
$self->NEXTKEY(); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#------------------------------------------- |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub NEXTKEY($) |
55
|
274
|
|
|
274
|
|
1644
|
{ my $self = shift; |
56
|
274
|
|
|
|
|
399
|
my $folder = $self->{MBT_folder}; |
57
|
274
|
|
|
|
|
469
|
my $nrmsgs = $folder->messages; |
58
|
|
|
|
|
|
|
|
59
|
274
|
|
|
|
|
322
|
my $msg; |
60
|
274
|
|
|
|
|
356
|
while(1) |
61
|
277
|
|
|
|
|
376
|
{ my $index = $self->{MBT_each_index}++; |
62
|
277
|
100
|
|
|
|
485
|
return undef if $index >= $nrmsgs; |
63
|
|
|
|
|
|
|
|
64
|
271
|
|
|
|
|
465
|
$msg = $folder->message($index); |
65
|
271
|
100
|
|
|
|
544
|
last unless $msg->isDeleted; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
268
|
|
|
|
|
472
|
$msg->messageId; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub EXISTS($) |
73
|
0
|
|
|
0
|
|
|
{ my $folder = shift->{MBT_folder}; |
74
|
0
|
|
|
|
|
|
my $msgid = shift; |
75
|
0
|
|
|
|
|
|
my $msg = $folder->messageId($msgid); |
76
|
0
|
0
|
|
|
|
|
defined $msg && ! $msg->isDeleted; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub DELETE($) |
81
|
0
|
|
|
0
|
|
|
{ my ($self, $msgid) = @_; |
82
|
0
|
|
|
|
|
|
$self->{MBT_folder}->messageId($msgid)->delete; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
#------------------------------------------- |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub CLEAR() |
89
|
0
|
|
|
0
|
|
|
{ my $folder = shift->{MBT_folder}; |
90
|
0
|
|
|
|
|
|
$_->delete foreach $folder->messages; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#------------------------------------------- |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |