Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created September 24, 2014 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bessarabov/650c0099e7a14ed18c5e to your computer and use it in GitHub Desktop.
Save bessarabov/650c0099e7a14ed18c5e to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use utf8;
use open qw(:std :utf8);
package Animal;
sub new {
my ($class) = @_;
my $self = {};
bless $self, $class;
return $self;
}
sub walk {
my ($self) = @_;
print "I'm walking\n";
return;
}
sub set_name {
my ($self, $name) = @_;
$self->{_name} = $name;
return;
}
package Human;
use base 'Animal';
sub say {
my ($self) = @_;
print "Hello, world!";
return;
}
package main;
sub main {
my $person = Human->new();
$person->set_name('Борис');
use Data::Dumper;
print Dumper $person;
}
main();
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment