From 35ee7e44a62f9126a83c1243b549d47cc5ca7b43 Mon Sep 17 00:00:00 2001 From: joey Date: Wed, 8 Nov 2006 21:03:33 +0000 Subject: * Make sure to check for errors from every eval. --- IkiWiki/Rcs/git.pm | 2 ++ IkiWiki/Rcs/mercurial.pm | 1 + IkiWiki/Rcs/svn.pm | 13 +++++++++---- IkiWiki/Rcs/tla.pm | 6 ++++++ 4 files changed, 18 insertions(+), 4 deletions(-) (limited to 'IkiWiki/Rcs') diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm index 09275fe5f..c8b5adc45 100644 --- a/IkiWiki/Rcs/git.pm +++ b/IkiWiki/Rcs/git.pm @@ -344,6 +344,7 @@ sub rcs_recentchanges ($) { #{{{ my ($num) = @_; eval q{use Date::Parse}; + error($@) if $@; my ($sha1, $type, $when, $diffurl, $user, @pages, @message, @rets); INFO: foreach my $ci (git_commit_info('HEAD', $num)) { @@ -458,6 +459,7 @@ sub rcs_notify () { #{{{ ); eval q{use Mail::Sendmail}; + error($@) if $@; foreach my $email (@email_recipients) { sendmail( To => $email, diff --git a/IkiWiki/Rcs/mercurial.pm b/IkiWiki/Rcs/mercurial.pm index 82a2fa642..36972c560 100644 --- a/IkiWiki/Rcs/mercurial.pm +++ b/IkiWiki/Rcs/mercurial.pm @@ -91,6 +91,7 @@ sub rcs_recentchanges ($) { #{{{ my ($num) = @_; eval q{use CGI 'escapeHTML'}; + error($@) if $@; my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num); open (my $out, "@cmdline |"); diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm index f3e353cbe..2d3ad046c 100644 --- a/IkiWiki/Rcs/svn.pm +++ b/IkiWiki/Rcs/svn.pm @@ -122,10 +122,13 @@ sub rcs_recentchanges ($) { #{{{ return unless -d "$config{srcdir}/.svn"; - eval q{use Date::Parse}; - eval q{use Time::Duration}; - eval q{use XML::SAX}; - eval q{use XML::Simple}; + eval q{ + use Date::Parse; + use Time::Duration; + use XML::SAX; + use XML::Simple; + }; + error($@) if $@; # avoid using XML::SAX::PurePerl, it's buggy with UTF-8 data my @parsers = map { ${$_}{Name} } @{XML::SAX->parsers()}; @@ -241,6 +244,7 @@ sub rcs_notify () { #{{{ ); eval q{use Mail::Sendmail}; + error($@) if $@; foreach my $email (@email_recipients) { sendmail( To => $email, @@ -276,6 +280,7 @@ sub rcs_getctime ($) { #{{{ } eval q{use Date::Parse}; + error($@) if $@; $date=str2time($date); debug("found ctime ".localtime($date)." for $file"); return $date; diff --git a/IkiWiki/Rcs/tla.pm b/IkiWiki/Rcs/tla.pm index c9b64dbe5..c71c9e6ee 100644 --- a/IkiWiki/Rcs/tla.pm +++ b/IkiWiki/Rcs/tla.pm @@ -89,7 +89,9 @@ sub rcs_recentchanges ($) { return unless -d "$config{srcdir}/{arch}"; eval q{use Date::Parse}; + error($@) if $@; eval q{use Mail::Header}; + error($@) if $@; my $logs = `tla logs -d $config{srcdir}`; my @changesets = reverse split(/\n/, $logs); @@ -159,6 +161,7 @@ sub rcs_notify () { #{{{ my $rev=int(possibly_foolish_untaint($ENV{REV})); eval q{use Mail::Header}; + error($@) if $@; open(LOG, $ENV{"ARCH_LOG"}); my $head = Mail::Header->new(\*LOG); close(LOG); @@ -214,6 +217,7 @@ sub rcs_notify () { #{{{ ); eval q{use Mail::Sendmail}; + error($@) if $@; foreach my $email (@email_recipients) { sendmail( To => $email, @@ -228,7 +232,9 @@ sub rcs_notify () { #{{{ sub rcs_getctime ($) { #{{{ my $file=shift; eval q{use Date::Parse}; + error($@) if $@; eval q{use Mail::Header}; + error($@) if $@; my $logs = `tla logs -d $config{srcdir}`; my @changesets = reverse split(/\n/, $logs); -- cgit v1.2.3