#!/usr/bin/perl -w # $Id: votify,v 1.5 2005/05/16 04:03:46 agriffis Exp $ # # Copyright 2005-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # # votify: generate, verify and submit voting ballots for trustee elections # BEGIN { my $dirname; if(-f '/etc/elections/Votify.pm') { $dirname = '/etc/elections'; } else { use File::Basename; $dirname = dirname(__FILE__); } push @INC, $dirname; } use POSIX; use Getopt::Long; use List::Util; use Votify 'user'; use strict; ###################################################################### # Global vars ###################################################################### (my $zero = $0) =~ s,.*/,,; (my $version = $Votify::version) =~ s/.*?(\d.*\d).*/$zero version $1\n/; my (%opt, %elections); # Collect the open elections my ($usage_elections); %elections = Votify::get_open_elections_hash(); if (scalar(keys %elections) > 0) { $usage_elections = "Presently available elections:\n" . join('', map { my ($name) = $_; my ($start) = strftime($Votify::datefmt, gmtime($elections{$name}{starttime})); my ($stop) = strftime($Votify::datefmt, gmtime($elections{$name}{stoptime})); sprintf("\t%s: %s to %s\n", $name, $start, $stop) } keys %elections); $usage_elections .= <