Email::Folder(3pm)

πŸ“¦
version 0.860 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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::LocalDelivery
  • Email::FolderType
  • Email::Simple

🌟 AUTHORS 🌟

the legends themselves:

  • Simon Wistow <simon@thegestalt.org>
  • Richard Clamp <richardc@unixbeard.net>
  • Pali <pali@cpan.org>

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 is Email::Folder(3pm), perl v5.36.0, dated 2022-10-14. mwah πŸ’‹ go read your mail folders, you gorgeous genius πŸŽ€βœ¨
πŸ“¦ where this page comes from