Mail::...r::Grep(3pm)

πŸ“¦
version 1.5111 Β· 5 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Mail::Mbox::MessageParser::Grep πŸ’–

okay bestie, so this is a page from the Mail::...r::Grep(3pm) corner of the manual β€” a User Contributed Perl Documentation situation β€” and it's literally all about one very specific little module. let's get into it 🫢


✨ NAME ✨

Mail::Mbox::MessageParser::Grep β€” it's giving "a GNU grep-based mbox folder reader" πŸ’…


🌸 SYNOPSIS 🌸

#!/usr/bin/perl

use Mail::Mbox::MessageParser;

my $filename = 'mail/saved-mail';
my $filehandle = new FileHandle($filename);

my $folder_reader =
  new Mail::Mbox::MessageParser( {
    'file_name' => $filename,
    'file_handle' => $filehandle,
    'enable_grep' => 1,
  } );

die $folder_reader unless ref $folder_reader;

# Any newlines or such before the start of the first email
my $prologue = $folder_reader->prologue;
print $prologue;

# This is the main loop. It's executed once for each email
while(!$folder_reader->end_of_file());
{
  my $email = $folder_reader->read_next_email();
  print $email;
}

πŸ¦‹ DESCRIPTION πŸ¦‹

So this module implements a GNU grep-based mbox folder reader, no cap. But here's the thing β€” it can only be used when GNU grep is installed on the system. like, that's non-negotiable, that's the whole vibe check. πŸ”₯

bestie listen: users must not instantiate this class directly β€” use Mail::Mbox::MessageParser instead. periodt. The base MessageParser module will automatically manage the use of grep and non-grep implementations, so just let it do its thing πŸ’…

πŸŽ€ METHODS AND FUNCTIONS πŸŽ€

The following methods and functions are specific to the Mail::Mbox::MessageParser::Grep package. For additional inherited ones, see the Mail::Mbox::MessageParser documentation. iykyk πŸ‘‘

$ref = new( { 'file_name' => <mailbox file name>, 'file_handle' => <mailbox file handle> });

  • <file_name> β€” the full filename of the mailbox πŸ“
  • <file_handle> β€” an opened file handle for the mailbox πŸ”“

The constructor for the class takes two parameters. The file_name parameter is the filename of the mailbox. The file_handle argument is the opened file handle to the mailbox.

Returns a reference to a Mail::Mbox::MessageParser object, or a string describing the error. (so like, check your refs, bestie β€” die $folder_reader unless ref $folder_reader; is the move 😭)

end_of_file()

reset()

read_next_email()

These methods are overridden in this subclass of Mail::Mbox::MessageParser. slay πŸ’–


πŸ’€ BUGS πŸ’€

No known bugs. iconic honestly, we love a clean record ✨

Contact david@coppit.org for bug reports and suggestions. πŸ“§


πŸ‘‘ AUTHOR πŸ‘‘

David Coppit <david@coppit.org>.


🌈 LICENSE 🌈

This code is distributed under the GNU General Public License (GPL) Version 2. See the file LICENSE in the distribution for details. πŸŽ€


🧚 HISTORY 🧚

This code was originally part of the grepmail distribution. See http://grepmail.sf.net/ for previous versions of grepmail which included early versions of this code. throwback fr fr πŸ’œ


⭐ SEE ALSO ⭐

Mail::Mbox::MessageParser


and that's the whole page, bestie!! πŸ“ this was perl v5.36.0, dated 2023-08-06, from the Mail::...r::Grep(3pm) manual β€” thanks for reading my little info dump, ily, go parse some mailboxes πŸ’–βœ¨πŸ«Ά