line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Voting.pm 60 2008-09-02 12:11:49Z johntrammell $ |
2
|
|
|
|
|
|
|
# $URL: https://algorithm-voting.googlecode.com/svn/tags/rel-0.01-1/lib/Algorithm/Voting.pm $ |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Algorithm::Voting; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
23082
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=pod |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Algorithm::Voting - voting algorithm implementations |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Algorithm::Voting::Ballot; |
22
|
|
|
|
|
|
|
use Algorithm::Voting::Plurality; |
23
|
|
|
|
|
|
|
my $box = Algorithm::Voting::Plurality->new(); # a ballot box |
24
|
|
|
|
|
|
|
foreach my $candidate (get_votes()) { |
25
|
|
|
|
|
|
|
$box->add( Algorithm::Voting::Ballot->new($candidate) ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
print $box->as_string; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Modules in this package implement various voting algorithms (e.g. Plurality, |
32
|
|
|
|
|
|
|
Sortition, etc.) as well as related objects (ballots, etc.). |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 AUTHOR |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
johntrammell@gmail.com, C<< >> |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 BUGS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Please report any bugs or feature requests via the Google Code web interface at |
41
|
|
|
|
|
|
|
L. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SUPPORT |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
perldoc Algorithm::Voting |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This project is hosted at Google Code. You can find up-to-date information on |
50
|
|
|
|
|
|
|
this project at URL L. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Copyright 2008 johntrammell@gmail.com, all rights reserved. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This software is intended for educational and entertainment purposes only. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
59
|
|
|
|
|
|
|
under the same terms as Perl itself. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|