#!/usr/bin/perl -w $pid = fork; if ($pid == -1) { print "woops ... $!"; exit; } elsif ($pid != 0) { exit; } use LWP::UserAgent; $suffix = ""; $temp = `mktemp /tmp/patch.XXXXXX`; chomp $temp; open SAL, ">", $temp or die "$temp: $!"; $agent = LWP::UserAgent->new(keep_alive => 3); while (<>) { if (!defined $subject && /^Subject: \[COMMITTERS\] pgsql: (.*)/) { $subject = $1; } elsif (m/^Modified/) { $suffix = "&f=H"; } elsif (m/^Added/) { $suffix = ""; } elsif (m,\((http://[^)]*)\)$,) { my $url = $1.$suffix; $res = $agent->get($url); print SAL $res->content; } } close SAL; $subject =~ s/[ _'\/]/_/g; rename $temp, sprintf ("/tmp/patch.%s.html", $subject);