App-ForKids-LogicalPuzzleGenerator
view release on metacpan or search on metacpan
lib/App/ForKids/LogicalPuzzleGenerator/Variable/Profession.pm view on Meta::CPAN
package App::ForKids::LogicalPuzzleGenerator::Variable::Profession;
use strict;
use warnings FATAL => 'all';
use Carp;
use base 'App::ForKids::LogicalPuzzleGenerator::Variable';
=head1 NAME
App::ForKids::LogicalPuzzleGenerator::Variable::Profession
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.01';
=head1 SYNOPSIS
The module is used by the App::ForKids::LogicalPuzzleGenerator.
use App::ForKids::LogicalPuzzleGenerator;
=cut
our @professions =
(
"wizard",
"warrior",
"witcher",
"blacksmith",
"fisherman",
"lumberjack"
);
=head1 SUBROUTINES/METHODS
=head2 new
=cut
sub new
{
my $class = shift;
my $this = $class->SUPER::new(@_);
# select the professions
for my $i (0..$$this{amount_of_values}-1)
{
while (1)
{
my $value = $professions[int(rand()*@professions)];
if (!grep {$_ eq $value } @{$$this{selected_values}})
{
push @{$$this{selected_values}}, $value;
last;
}
}
}
return $this;
}
=head2 get_description
=cut
sub get_description
{
return "Each has a different profession";
}
=head2 get_description_I
=cut
sub get_description_I
{
my ($this, $profession) = @_;
return sprintf("I am a %s.", $profession);
}
=head2 get_description_I_dont
=cut
sub get_description_I_dont
{
my ($this, $profession) = @_;
return sprintf("I am not a %s.", $profession);
}
=head2 get_description_he_does_not
=cut
sub get_description_he_does_not
{
my ($this, $profession) = @_;
return sprintf("is not a %s.", $profession);
}
=head2 get_description_the_one_who
=cut
( run in 1.568 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )