From: Jonathan McDowell Date: Fri, 10 Jun 2016 07:58:12 +0000 (+0100) Subject: Fix errors in onak-mail.pl X-Git-Tag: onak-0.5.0~11 X-Git-Url: http://the.earth.li/gitweb/?p=onak.git;a=commitdiff_plain;h=4ab0e97e5ff2dab7dcc5ae14050e442892b8f0ff Fix errors in onak-mail.pl The change to the new configuration file format introduced some paper bag errors in the mail processing script. Fix these, and add a Perl syntax check into the test target to try and prevent this sort of thing in future. --- diff --git a/Makefile.in b/Makefile.in index 28e93c9..d0acbfd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -56,6 +56,7 @@ all: .depend $(PROGS) testparse maxpath sixdegrees splitkeys onak.ini \ wotsap $(BACKENDS) test: onak $(BACKENDS) + perl -cw onak-mail.pl @./runtests install: $(PROGS) onak.ini $(BACKENDS) diff --git a/onak-mail.pl.in b/onak-mail.pl.in index 68439d2..8231a12 100644 --- a/onak-mail.pl.in +++ b/onak-mail.pl.in @@ -65,17 +65,17 @@ sub readconfig { open(CONFIG, "@CONFIG@") or die "Can't read config file: $!"; - $section = ""; + my $section = ""; while () { if (/^#/ or /^$/) { # Ignore; comment line. } elsif (/^\[(\w+)\]/) { - section = $1; - } elsif ($section == "main") { + $section = $1; + } elsif ($section eq "main") { if (/^logfile\s*=\s*(.*)/) { $config{'logfile'} = $1; } - } elsif ($section == "mail") { + } elsif ($section eq "mail") { if (/^this_site\s*=\s*(.*)/) { $config{'thissite'} = $1; } elsif (/^maintainer_email\s*=\s*(.*)/) {