Skip to content

Instantly share code, notes, and snippets.

@tomcha
Last active December 21, 2015 01:48
Show Gist options
  • Save tomcha/6229838 to your computer and use it in GitHub Desktop.
Save tomcha/6229838 to your computer and use it in GitHub Desktop.
package Neko;
sub new{
my $class = shift;
my $self = {
name => 'none',
color => 'none'
};
return bless $self,$class;
}
sub name{
my $self = shift;
if(@_){
$self->{name} = shift;
}
return $self->{name};
}
sub color{
my $self = shift;
if(@_){
$self->{clolor} = shift;
}
return $self->{color};
}
sub says{
my $self = shift;
print 'my name is '.$self->name().".\n";
print 'my color is '.$self->color().".\n\n";
}
sub loves{
my $self = shift;
print $self->name().' loves azuma(neko)san'."\n";
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment