Email::Folder(3pm)
π Email::Folder β bestie edition π
okay so Email::Folder is the module that lets you read all the messages out of a folder as Email::Simple objects. that's it, that's the whole vibe. you point it at a folder, it hands you mail objects, you go live your life. it's giving mailbox main character energy fr fr π¦
β¨ VERSION β¨
version 0.860 β yes queen, that's the one π
πΈ SYNOPSIS πΈ
look at how easy this is. no cap.
use Email::Folder;
my $folder = Email::Folder->new("some_file");
print join "\n", map { $_->header("Subject") } $folder->messages;
literally three lines and you're printing every Subject header in the folder. slay π
π METHODS π
π§ new($folder, %options)
so you hand it the name of a folder, plus a hash of options, and boom β you got yourself a folder object.
if you pass in a 'reader' option, that thing gets used as the class it reads messages in with. iykyk β¨
π messages
returns a list containing all of the messages in the folder. iconic. the whole entire folder. every single one.
β οΈ okay bestie listen β this can only be called once, because it drains the iterator. call it twice and the second call gets nothing. it's giving "you had one shot". don't say i didn't warn you π
π₯ next_message
this one acts as an iterator. it reads the next message from the folder, one at a time, at your own pace. when you hit the end of the folder it returns false. so like
while (my $msg = $folder->next_message) { ... }
and that's the whole loop, periodt π
π bless_message($message)
takes a raw RFC822 message and blesses it into a class. very demure, very mindful.
by default this is an Email::Simple object, but it can easily be overridden in a subclass. π«Ά
for example β and honestly this is such a flex β this simple subclass just returns the raw rfc822 messages, and exposes the speed of the parser:
package Email::RawFolder;
use base 'Email::Folder';
sub bless_message { $_[1] };
1;
not me dropping a whole subclass in the middle of a manpage π go off.
π¦ reader
read-only accessor to the underlying Email::Reader subclass instance. you can look, you cannot touch. admire respectfully π
π SEE ALSO π
go check these out too, they're all in the same friend group:
Email::LocalDeliveryEmail::FolderTypeEmail::Simple
π AUTHORS π
the legends themselves:
- Simon Wistow <simon@thegestalt.org>
- Richard Clamp <richardc@unixbeard.net>
- Pali <pali@cpan.org>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2006 by Simon Wistow.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π
and that's the whole page bestie!! this absolute banger of a doc isEmail::Folder(3pm), perlv5.36.0, dated2022-10-14. mwah π go read your mail folders, you gorgeous genius πβ¨
π¦ where this page comes from
- ubuntu noble: libemail-folder-perl 0.860-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libemail-folder-perl 0.860-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libemail-folder-perl 0.860-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms