#!/usr/bin/perl # Script to generate the list of voters for the website. # # How to use this script # ====================== # # You probably want to first update the verification on the last_accepted # variable. The date should be less than two years before the end of the vote. # # Create a voters.txt file with this command: # $ mysqldump -h button-back -u vuntz -p --no-create-info foundation foundationmembers > voters.txt # # You should use this script like this: # $ ./generate-list-voters.pl voters.txt | sort die "Usage: generate-list-voters.pl \n" unless $#ARGV == 0; open MEMBERS, "<$ARGV[0]" || die "Cannot open file $ARGV[0]: $!"; while () { chomp; next if (/^--/ || /^$/); if (!(/^ *INSERT INTO foundationmembers VALUES \(\d*,'(.*)','(.*)','.*@.*',.*,'.*','(.*)','.*'\) *; *$/)) { print "Error for line: $_\n"; next; } my $firstname = $1; my $lastname = $2; my $last_accepted = $3; $_ = $last_accepted; ($year, $month, $day) = m/^(.*)-(.*)-(.*)/os; # This is what you want to update :-) next if ($year < 2003); next if ($year == 2003 && $month < 11); next if ($year == 2003 && $month == 11 && $day < 11); print "
  • $firstname $lastname
  • \n"; } close MEMBERS;