Acme-Affinity
view release on metacpan or search on metacpan
my @importance = sort { $affinity->importance->{$a} <=> $affinity->importance->{$b} } keys %{ $affinity->importance };
my $i = 0;
for my $question (shuffle @$questions) {
$i++;
my @answer = ();
my $tc = Term::Choose->new({
prompt => "$i. $question->{q}",
clear_screen => 1,
});
my $choice = $tc->choose($question->{a});
push @answer, $choice;
print "\n\n\n";
$tc = Term::Choose->new({ prompt => 'You want:' });
$choice = $tc->choose($question->{a});
push @answer, $choice;
print "\n\n\n";
$tc = Term::Choose->new({ prompt => 'How important is this to you?' });
$choice = $tc->choose(\@importance);
push @answer, $choice;
$answers{ $question->{i} } = \@answer;
}
Term::Clear::clear();
# Sorted me answers
my $me = [ map { $answers{$_} } sort { $a <=> $b } keys %answers ];
( run in 0.519 second using v1.01-cache-2.11-cpan-6aa56a78535 )