/usr/share/doc/libmail-box-perl/examples/grep.pl is in libmail-box-perl 2.117-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #!/usr/bin/perl
# Demonstration of a simple search.
#
# This code can be used and modified without restriction.
# Mark Overmeer, <mailbox@overmeer.net>, 17 feb 2002
# Updated 16 jan 2003 to work more like unix-grep syntax
use warnings;
use strict;
use lib '..', '.';
use Mail::Box::Manager 2.008;
use Mail::Box::Search::Grep;
#
# Get the command line arguments.
#
die "Usage: $0 pattern mailboxes\n"
unless @ARGV >= 2;
my ($pattern, @mailboxes) = @ARGV;
my $mgr = Mail::Box::Manager->new;
foreach my $mailbox (@mailboxes)
{ my $folder = $mgr->open($mailbox);
unless(defined $folder)
{ warn "*** Cannot open folder $mailbox.\n";
next;
}
print "*** Scanning through $mailbox\n"
if @mailboxes > 1;
my $grep = Mail::Box::Search::Grep->new
( in => 'MESSAGE'
, match => qr/$pattern/
, details => 'PRINT'
);
$grep->search($folder);
$folder->close;
}
|