]> the.earth.li Git - onak.git/commitdiff
Fix errors in onak-mail.pl
authorJonathan McDowell <noodles@earth.li>
Fri, 10 Jun 2016 07:58:12 +0000 (08:58 +0100)
committerJonathan McDowell <noodles@earth.li>
Fri, 10 Jun 2016 07:58:12 +0000 (08:58 +0100)
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.

Makefile.in
onak-mail.pl.in

index 28e93c9d6829b033fea4e36a7d7d23e33497277b..d0acbfdc62da54fd8d0c300e0d5a542620ba31b4 100644 (file)
@@ -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)
index 68439d242079506fdeaac1eb24be8d9539321086..8231a127e22abd762e5ff495445b63a1d90f25d3 100644 (file)
@@ -65,17 +65,17 @@ sub readconfig {
        open(CONFIG, "@CONFIG@") or
                die "Can't read config file: $!";
 
-       $section = "";
+       my $section = "";
        while (<CONFIG>) {
                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*(.*)/) {