| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::ForKids::LogicalPuzzleGenerator::Variable::Profession; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 23 |  | 
| 4 | 1 |  |  | 1 |  | 4 | use warnings FATAL => 'all'; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 23 |  | 
| 5 | 1 |  |  | 1 |  | 3 | use Carp; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 38 |  | 
| 6 | 1 |  |  | 1 |  | 5 | use base 'App::ForKids::LogicalPuzzleGenerator::Variable'; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 393 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | =head1 NAME | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | App::ForKids::LogicalPuzzleGenerator::Variable::Profession | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | =head1 VERSION | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | Version 0.01 | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | =cut | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | our $VERSION = '0.01'; | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | The module is used by the App::ForKids::LogicalPuzzleGenerator. | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | use App::ForKids::LogicalPuzzleGenerator; | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | =cut | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | our @professions = | 
| 33 |  |  |  |  |  |  | ( | 
| 34 |  |  |  |  |  |  | "wizard", | 
| 35 |  |  |  |  |  |  | "warrior", | 
| 36 |  |  |  |  |  |  | "witcher", | 
| 37 |  |  |  |  |  |  | "blacksmith", | 
| 38 |  |  |  |  |  |  | "fisherman", | 
| 39 |  |  |  |  |  |  | "lumberjack" | 
| 40 |  |  |  |  |  |  | ); | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | =head1 SUBROUTINES/METHODS | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =head2 new | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =cut | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub new | 
| 50 |  |  |  |  |  |  | { | 
| 51 | 0 |  |  | 0 | 1 |  | my $class = shift; | 
| 52 | 0 |  |  |  |  |  | my $this = $class->SUPER::new(@_); | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | # select the professions | 
| 55 | 0 |  |  |  |  |  | for my $i (0..$$this{amount_of_values}-1) | 
| 56 |  |  |  |  |  |  | { | 
| 57 | 0 |  |  |  |  |  | while (1) | 
| 58 |  |  |  |  |  |  | { | 
| 59 | 0 |  |  |  |  |  | my $value = $professions[int(rand()*@professions)]; | 
| 60 | 0 | 0 |  |  |  |  | if (!grep {$_ eq $value } @{$$this{selected_values}}) | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | { | 
| 62 | 0 |  |  |  |  |  | push @{$$this{selected_values}}, $value; | 
|  | 0 |  |  |  |  |  |  | 
| 63 | 0 |  |  |  |  |  | last; | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  | } | 
| 67 | 0 |  |  |  |  |  | return $this; | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | =head2 get_description | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | =cut | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | sub get_description | 
| 75 |  |  |  |  |  |  | { | 
| 76 | 0 |  |  | 0 | 1 |  | return "Each has a different profession"; | 
| 77 |  |  |  |  |  |  | } | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =head2 get_description_I | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | =cut | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | sub get_description_I | 
| 84 |  |  |  |  |  |  | { | 
| 85 | 0 |  |  | 0 | 1 |  | my ($this, $profession) = @_; | 
| 86 | 0 |  |  |  |  |  | return sprintf("I am a %s.", $profession); | 
| 87 |  |  |  |  |  |  | } | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =head2 get_description_I_dont | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | =cut | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | sub get_description_I_dont | 
| 94 |  |  |  |  |  |  | { | 
| 95 | 0 |  |  | 0 | 1 |  | my ($this, $profession) = @_; | 
| 96 | 0 |  |  |  |  |  | return sprintf("I am not a %s.", $profession); | 
| 97 |  |  |  |  |  |  | } | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =head2 get_description_he_does_not | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =cut | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | sub get_description_he_does_not | 
| 104 |  |  |  |  |  |  | { | 
| 105 | 0 |  |  | 0 | 1 |  | my ($this, $profession) = @_; | 
| 106 | 0 |  |  |  |  |  | return sprintf("is not a %s.", $profession); | 
| 107 |  |  |  |  |  |  | } | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =head2 get_description_the_one_who | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =cut | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | sub get_description_the_one_who | 
| 114 |  |  |  |  |  |  | { | 
| 115 | 0 |  |  | 0 | 1 |  | my ($this, $profession) = @_; | 
| 116 | 0 |  |  |  |  |  | return sprintf("The %s", $profession); | 
| 117 |  |  |  |  |  |  | } | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =head2 get_description_X | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =cut | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | sub get_description_X | 
| 124 |  |  |  |  |  |  | { | 
| 125 | 0 |  |  | 0 | 1 |  | my ($this, $who, $profession) = @_; | 
| 126 | 0 |  |  |  |  |  | return sprintf("%s is a %s.", $who, $profession); | 
| 127 |  |  |  |  |  |  | } | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | =head2 get_description_X_does_not | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =cut | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | sub get_description_X_does_not | 
| 135 |  |  |  |  |  |  | { | 
| 136 | 0 |  |  | 0 | 1 |  | my ($this, $who, $profession) = @_; | 
| 137 | 0 |  |  |  |  |  | return sprintf("%s is not a %s.", $who, $profession); | 
| 138 |  |  |  |  |  |  | } | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | =head2 get_description_he_likes | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | =cut | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | sub get_description_he_likes | 
| 145 |  |  |  |  |  |  | { | 
| 146 | 0 |  |  | 0 | 1 |  | my ($this, $profession) = @_; | 
| 147 | 0 |  |  |  |  |  | return sprintf("is a %s.", $profession); | 
| 148 |  |  |  |  |  |  | } | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | =head1 AUTHOR | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | Pawel Biernacki, C<<  >> | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | =head1 BUGS | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | Please report any bugs or feature requests to C, or through | 
| 159 |  |  |  |  |  |  | the web interface at L.  I will be notified, and then you'll | 
| 160 |  |  |  |  |  |  | automatically be notified of progress on your bug as I make changes. | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  | =cut | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | 1; |