my %options;
GetOptions(\%options,
'option=s@',
+ 'default_option|default-option!',
);
if (not exists $options{option} or not ref($options{option}) or
@{$options{option}} < 2
majority => $majority,
};
}
- winner(options=>\@options);
+ winner(options=>\@options,
+ default_option => exists $options{default_option} ? $options{default_option} : 1,
+ );
}
sub encode_base64{
tally_fh => {type => HANDLE,
optional => 1,
},
+ default_option => {default => 1,
+ type => BOOLEAN,
+ },
},
);
# options is an array to keep it ordered
my %Drop = ();
- foreach my $i (0..($max_choices - 2)) {
- if ($K > $Beat_Matrix[$i][$max_choices - 1]) {
- $Drop{$i}++;
- print {$RESULTS} "Dropping Option", $order_to_options{$i + 1}{key},
- " \"", $order_to_options{$i + 1}{name},
- "\" because of Quorum\n";
- } else {
- print {$RESULTS} "Option ", $order_to_options{$i + 1}{key},
- " Reached quorum: $Beat_Matrix[$i][$max_choices - 1] > $K\n";
+ if ($params{default_option}) {
+ foreach my $i (0..($max_choices - 2)) {
+ if ($K > $Beat_Matrix[$i][$max_choices - 1]) {
+ $Drop{$i}++;
+ print {$RESULTS} "Dropping Option", $order_to_options{$i + 1}{key},
+ " \"", $order_to_options{$i + 1}{name},
+ "\" because of Quorum\n";
+ } else {
+ print {$RESULTS} "Option ", $order_to_options{$i + 1}{key},
+ " Reached quorum: $Beat_Matrix[$i][$max_choices - 1] > $K\n";
+ }
}
+ print {$RESULTS} "\n\n";
}
- print {$RESULTS} "\n\n";
# Record Majority
my %Ratio = ();