2. “the world's best and most effective Perl
programmers take full advantage of the
CPAN to make up for missing language
features, to improve their productivity, and
because solving a problem once and for all
and sharing it is the ultimate expression of
laziness, impatience, and hubris”
- chromatic
11. package Person;
sub new {
my ($class, %args) = @_;
die(„Name is required‟)
if !$args{name};
die(„Name must be a string‟)
if ref $args{name};
return bless %args, $class;
}
sub hello {
my ($self) = @_;
print „Hi, my name is, „ .
$self->{name} . “n”;
}
13. package Person;
use Moose;
use MooseX::Method::Signature;
has „name‟ => (
is => ‟rw‟,
isa => ‟Str‟,
required => 1,
);
method hello {
say „Hi, my name is, „ .
$self->name();
}