#!/usr/bin/perl -w
#
# $Revision: 1.3 $ $Date: 2012-07-26 17:11:47-04 $
# $Source: /home/vogelke/bin/RCS/burst-python,v $
# $Host: sys7.com $
# $UUID: d7baf5d9-aa83-38c0-875b-c23522848fbf $
#
#<burst-python: burst Python mailing-list messages.

use strict;

my $border = '--__--__--';
my $from;

# Find initial from line.
while (<>) {
    $from = $_ if /^From /;
    last if /$border/;
}

# Read each message in turn.
# This should be called from procmail;
# stdout goes to regular mailbox.
$/ = "$border";

while (<>) {
    chomp;
    last if /End of Python-list Digest/;

    s/^\n\n*//g;
    s/\n\n*$//g;
    s/^Message: [0-9]*\n//g;

    print "$from";
    print "$_\n\n";
}

exit (0);
