package Monks::Data;
use strict;
use warnings;
our $VERSION = '20160808.00';
sub get_furries { [qw{Rabbits Minks Cats}] }
sub get_texture_for { +{qw{Rabbits soft Minks supersoft Cats coarse}} }
1;
####
package Monks;
use strict;
use warnings;
our $VERSION = '0.01';
use Monks::Data;
sub new {
my ($class, @args) = @_;
bless { @args } => $class;
}
sub is_furry {
my ($self, $furry) = @_;
grep { /$furry/ } @{Monks::Data::->get_furries};
}
sub find_fur_texture {
my ($self, $fur) = @_;
Monks::Data::->get_texture_for->{$fur};
}
1;
####
#!/usr/bin/env perl -l
use strict;
use warnings;
use Monks;
my $obj = Monks::->new;
for (qw{Cats Alligators Rabbits}) {
print $_, ': furry? ', $obj->is_furry($_) ? 'Yes' : 'No';
}
print 'Fur texture for Cats: ', $obj->find_fur_texture('Cats');
####
Cats: furry? Yes
Alligators: furry? No
Rabbits: furry? Yes
Fur texture for Cats: coarse