Re: extending Mail::Box with the manager?
Mark Overmeer <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Organization | MARKOV Solutions |
| Message-ID | <[email protected]> |
* Anthony D. Urso ([email protected]) [040107 17:17]: > On Wed, Jan 07, 2004 at 04:30:34PM +0100, Mark Overmeer wrote: > > > access to mailbox specific methods like loadHead and writeMessages? > > The methods you mention are all over the place, so it is a bit > > hard to understand what you would like to do exactly. > > I'm extending Mail::Box to add some trivial convenience methods, like > one that returns the number of new messages so I don't have to do the > grep { not $_->label('seen') } $folder->messages in other packages. $folder->messages('ACTIVE'); $folder->messages('DELETED'); $folder->messages('spam'); $folder->messages('!flagged'); > Also, I setup a companion to the Mail::Message labels() such that it > only returns ones that are set for that message. why? (if there is a common need for such functionality, then please supply a patch) > The caveat is that I'd rather not know what kind of mailbox is actually > there behind the scenes, so extending Mail::Box::Maildir or whichever would > be counterproductive. True. Therefore, you contribute it to the whole packages. For instance, a lot can be added to the autoloaded helper packages for Mail::Message, like Mail::Message::Construct::... Or you could write in your own code: package Mail::Message; sub added_functionality().... Which is considered a bit dirty, but works fine. > This is exactly what I was looking for, thanks. Is there a corresponding > mailbox_type? simply $mgr->open(type => 'mh'); or, what you are maybe looking for: $mgr->registerType(mbox => 'my::own::implementation') > This was a terrible example, I was just hoping to use a simple one that > was relevent to the writeMessages error, but I don't actually override > $folder->write. Ok... you probably want to extend Mail::Box::Maildir, not Mail::Box, because otherwise you have to reimplement writeMessages(). Do I understand your problem correctly now? -- MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions [email protected] [email protected] http://Mark.Overmeer.net http://solutions.overmeer.net