GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MAIL::BOX::TIE::HASH (3)

.ds Aq ’

NAME

Mail::Box::Tie::HASH - access an existing message folder as a hash

CONTENTS

SYNOPSIS



 tie my(%inbox), Mail::Box::Tie::HASH, $folder;

 foreach my $msgid (keys %inbox)
 {   print $inbox{$msgid};
     delete $inbox{$msgid};
 }

 $inbox{$msg->messageId} = $msg;



DESCRIPTION

Certainly when you look at a folder as being a set of related messages based on message-id, it is logical to access the folder through a hash.

For a tied hash, the message-id is used as the key. The message-id is usually unique, but when two or more instances of the same message are in the same folder, one will be flagged for deletion and the other will be returned.

This implementation uses basic folder access routines which are related to the message-id.

METHODS

    Constructors

<B>TIEHASHB>(’Mail::Box::Tie::HASH’, FOLDER) Connects the FOLDER object to a HASH.

example:



 my $mgr    = Mail::Box::Manager->new;
 my $folder = $mgr->open(access => rw);
 tie my(%inbox), Mail::Box::Tie::HASH, $folder;



    Tied Interface

$obj-><B>CLEARB>() Remove the contents of the hash. This is not really possible, but all the messages will be flagged for deletion.

example:



 %inbox = ();
 %inbox = ($msg->messageId, $msg); #before adding msg



$obj-><B>DELETEB>(MESSAGE-ID) Remove the message with the specified MESSAGE-ID.

example:



 delete $inbox{$msgid};



$obj-><B>EXISTSB>(MESSAGE-ID) Check whether a message with a certain MESSAGE-ID exists.

example:



 if(exists $inbox{$msgid}) ...



$obj-><B>FETCHB>(MESSAGEID) Get the message with the specified id. The returned message may be a dummy if message thread detection is used. Returns undef when there is no message with the specified id.

example:



 my $msg = $inbox{$msgid};
 if($inbox{$msgid}->isDummy)  ...



$obj-><B>FIRSTKEYB>() See NEXTKEY().
$obj-><B>NEXTKEYB>(PREVIOUS) FIRSTKEY() returns the first message-id/message pair from the folder, and NEXTKEY returns the message-id/message pair for the next message, in the order in which the message is stored in the folder.

Messages flagged for deletion will <B>notB> be returned. See the Mail::Box::messages() method of the folder type for more information about the folder message order.

example:



 foreach my $msgid (keys %inbox) ...
 foreach my $msg (values %inbox) ...

 while(my ($msgid, $msg) = each %inbox) {
    $msg->print unless $msg->isDeleted;
 }



$obj-><B>STOREB>(undef, MESSAGE) Store a message in the folder. The key must be undef, because the message-id of the specified message is taken. This is shown in the first example. However, as you see, it is a bit complicated to specify undef, therefore the string "undef" is accepted as well.

The message may be converted into something which can be stored in the folder type which is at stake. The added instance is returned.

example:



 $inbox{ (undef) } = $msg;
 $inbox{undef} = $msg;



SEE ALSO

This module is part of Mail-Box distribution version 2.109, built on August 19, 2013. Website: http://perl.overmeer.net/mailbox/

LICENSE

Copyrights 2001-2013 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MAIL::BOX::TIE::HASH (3) 2013-08-19

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.