Paul Cocker wrote:
======================
#!/usr/bin/perl

use warnings;
use strict;
use File::Copy;

my $valid_recpts = "/home/exchange/virtual.txt"; # original file from exchange my $relay_recps = "/home/exchange/relay_recipients"; # final file that will be postmapped my $dos2unix = `/usr/bin/dos2unix $valid_recpts`; # fix those pesky differences between dos en unix my $postfix_relayrcpts = "/etc/postfix/relay_recipients.db"; # final relay_recipients map my $relay_recpsdb = "/home/exchange/relay_recipients.db"; # original relay_recipients map

open(VALID,"< $valid_recpts") or die "$!\n"; open(RELAY,"> $relay_recps") or die "$!\n";

while(<VALID>) {
        next unless $_ =~ /^.*(smtp:)(.*\.nl)$/i;
        print RELAY "$2\tOK\n";
        }

close(VALID);
close(RELAY);

chown exchangeuser, exchangeuser, $valid_recpts; # otherwise exchange cannot overwrite it

my $postmap = `/usr/sbin/postmap $relay_recps`;

move($relay_recpsdb, $postfix_relayrcpts);

============================================

For me this generates the error:

Bareword "exchange" not allowed while "strict subs" in use at
./parserelay line 23.
Bareword "exchange" not allowed while "strict subs" in use at
./parserelay line 23.
Execution of ./parserelay aborted due to compilation errors.

That script has been line-wrapped badly. The quirky commenting style doesn't help, since putting comments on code lines makes for very long lines. Fix the line wrapping, and the script may well work.

Even if you don't know Perl, unwrapping that mess should be pretty easy. Perl lines logically end with a ';' and comments start with a '#' and that should be enough Perl syntax for you to repair the mangling of what above are lines 7-17 (should be 7-11, with 'my' as the first token on each of those) and lines 22-23.


Reply via email to