use warnings; use strict; { package Foo; use Data::Dump; use Scalar::Util qw/blessed/; sub new { return bless {}, shift } sub foo { my $self = shift if ref $_[0] eq __PACKAGE__; dd 'foo', $self, \@_; } sub bar { my $self = shift if defined blessed($_[0]) && $_[0]->isa(__PACKAGE__); dd 'bar', $self, \@_; } } { package Bar; use parent -norequire, 'Foo'; } Foo::foo('a'); # ("foo", undef, ["a"]) Foo::bar('b'); # ("bar", undef, ["b"]) my $f = Foo->new(); $f->foo('c'); # ("foo", bless({}, "Foo"), ["c"]) $f->bar('d'); # ("bar", bless({}, "Foo"), ["d"]) my $g = Bar->new(); $g->foo('e'); # ("foo", undef, [bless({}, "Bar"), "e"]) - oops! $g->bar('f'); # ("bar", bless({}, "Bar"), ["f"])