#!/usr/bin/perl -T use strict; use CGI; my $cgi = new CGI; if($cgi->param('update')) { # update the project working copy my $output = `svn up /home/ekaufman/svn/proj1 2>&1`; # output the update page print <<"HTMLCODE"; Content-Type: text/html; charset=utf-8
HTMLCODE # if anything other than the current revision (ie: an update or an error), mail me the output if($output !~ m/\A(?:\n*)At revision \d+.(?:\n*)\z/msx) { open(MAIL, "|/usr/lib/sendmail -t") or die('Couldnt send mail'); print MAIL <<"MAILCONTENT"; To: ekaufman\@mycompany.com Subject: Project updated... Output from svn up: -- output -- . MAILCONTENT close(MAIL); } } # otherwise, print a blank page print "Content-Type: text/html; charset=utf-8\n\n";