Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created September 24, 2014 06:06
Show Gist options
  • Save bessarabov/4b00b896b2d4e9921c6c to your computer and use it in GitHub Desktop.
Save bessarabov/4b00b896b2d4e9921c6c 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 DDP;
p $person;
}
main();
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment