/usr/share/perl5/Mail/Box/Tie/HASH.pm is in libmail-box-perl 2.099-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # Copyrights 2001-2011 by Mark Overmeer.
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.00.
use strict;
package Mail::Box::Tie::HASH;
use vars '$VERSION';
$VERSION = '2.099';
use Carp;
sub TIEHASH(@)
{ my ($class, $folder) = @_;
croak "No folder specified to tie to."
unless ref $folder && $folder->isa('Mail::Box');
bless { MBT_folder => $folder, MBT_type => 'HASH' }, $class;
}
#-------------------------------------------
sub FETCH($) { shift->{MBT_folder}->messageId(shift) }
#-------------------------------------------
sub STORE($$)
{ my ($self, $key, $basicmsg) = @_;
carp "Use undef as key, because the message-id of the message is used."
if defined $key && $key ne 'undef';
$self->{MBT_folder}->addMessages($basicmsg);
}
#-------------------------------------------
sub FIRSTKEY()
{ my $self = shift;
my $folder = $self->{MBT_folder};
$self->{MBT_each_index} = 0;
$self->NEXTKEY();
}
#-------------------------------------------
sub NEXTKEY($)
{ my $self = shift;
my $folder = $self->{MBT_folder};
my $nrmsgs = $folder->messages;
my $msg;
while(1)
{ my $index = $self->{MBT_each_index}++;
return undef if $index >= $nrmsgs;
$msg = $folder->message($index);
last unless $msg->isDeleted;
}
$msg->messageId;
}
#-------------------------------------------
sub EXISTS($)
{ my $folder = shift->{MBT_folder};
my $msgid = shift;
my $msg = $folder->messageId($msgid);
defined $msg && ! $msg->isDeleted;
}
#-------------------------------------------
sub DELETE($)
{ my ($self, $msgid) = @_;
$self->{MBT_folder}->messageId($msgid)->delete;
}
#-------------------------------------------
sub CLEAR()
{ my $folder = shift->{MBT_folder};
$_->delete foreach $folder->messages;
}
#-------------------------------------------
1;
|