9 use vars qw($dbhost $dbname $dbuser $dbpass $dbport
13 use FindBin qw($RealBin);
14 require "$RealBin/../BuildFarmWeb.pl";
16 die "no dbname" unless $dbname;
17 die "no dbuser" unless $dbuser;
19 my %opts = ( outfile => "/etc/mail/lists/farmers" );
24 my $dsn="dbi:Pg:dbname=$dbname";
25 $dsn .= ";host=$dbhost" if $dbhost;
26 $dsn .= ";port=$dbport" if $dbport;
28 my $db = DBI->connect($dsn,$dbuser,$dbpass);
30 die $DBI::errstr unless $db;
32 my $sth = $db->prepare(q[
34 FROM buildsystems AS b
35 ORDER BY owner_email ASC
40 while (my $row = $sth->fetchrow_hashref)
42 $list{$row->{owner_email}}++;
46 open(my $fh, ">", $opts{outfile});
48 print $fh (join "\n", (keys %list));