#!/usr/bin/perl -w # This file is maintained using GNU Arch on # http://mdcc.cx/arch/{archives}/2008-ad1810-stuff # Copyright: © 2005 Joost van Baal # This program is in the public domain. # probably written 2005-05 use strict; use IO::Handle; use File::stat; open (LOG, $ENV{'HOME'}."/var/log/maildrop.log") or die "can't open maildrop.log: $!"; $/ = ''; # paragraph read mode for readline access for (;;) { while () { # skip paragraphs like # # Date: Wed May 11 11:50:39 2005 # From: "Alice Friend" # Subj: Did you try hoodia? # File: Mail/spam/inbox (2250) # # I am not interested in my spam. /\nFile: Mail\/spam\/inbox / or print; } sleep 1; LOG->clearerr(); # abort if file have been (re)moved exit if stat(*LOG)->nlink == 0; }