#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use 5.010;
# Parent
use strict;
use warnings;
sub bar { 1448 }
}
# Child
use strict;
use warnings;
our @ISA = qw/Foo/;
sub baz { 1337 }
}
sub do_stuff {
my Bar
$instance = shift;
say $instance -> bar;
say $instance -> baz;
}; if ($@) {
say "Something went wrong: $@";
say "Tested instance: ". (Dumper $instance);
} else {
say "OK";
}
}
my $foo = new Foo;
my $bar = new Bar;
say 'Testing $foo';
do_stuff $foo;
say 'Testing $bar';
do_stuff $bar;
IyEvdXNyL2Jpbi9wZXJsCgp1c2Ugc3RyaWN0Owp1c2Ugd2FybmluZ3M7CnVzZSBEYXRhOjpEdW1wZXI7CnVzZSA1LjAxMDsKCiMgUGFyZW50CnBhY2thZ2UgRm9vIHsKCXVzZSBzdHJpY3Q7Cgl1c2Ugd2FybmluZ3M7CgoJc3ViIG5ldyB7IGJsZXNzIHt9LCBzaGlmdCB9CglzdWIgYmFyIHsgMTQ0OCB9Cn0KCiMgQ2hpbGQKcGFja2FnZSBCYXIgewoJdXNlIHN0cmljdDsKCXVzZSB3YXJuaW5nczsKCW91ciBASVNBID0gcXcvRm9vLzsKCglzdWIgbmV3IHsgYmxlc3Mge30sIHNoaWZ0IH0KCXN1YiBiYXogeyAxMzM3IH0KfQoKc3ViIGRvX3N0dWZmIHsKCW15IEJhciAkaW5zdGFuY2UgPSBzaGlmdDsKCglldmFsIHsKCQlzYXkgJGluc3RhbmNlIC0+IGJhcjsKCQlzYXkgJGluc3RhbmNlIC0+IGJhejsKCX07IGlmICgkQCkgewoJCXNheSAiU29tZXRoaW5nIHdlbnQgd3Jvbmc6ICRAIjsKCQlzYXkgIlRlc3RlZCBpbnN0YW5jZTogIi4gKER1bXBlciAkaW5zdGFuY2UpOwoJfSBlbHNlIHsKCQlzYXkgIk9LIjsKCX0KfQoKbXkgJGZvbyA9IG5ldyBGb287Cm15ICRiYXIgPSBuZXcgQmFyOwoKc2F5ICdUZXN0aW5nICRmb28nOwpkb19zdHVmZiAkZm9vOwoKc2F5ICdUZXN0aW5nICRiYXInOwpkb19zdHVmZiAkYmFyOwo=