use strict; use warnings; use v5.010; package PARENT; use constant PARENT_ONLY => 23; use constant BOTH => 42; package CHILD; use base 'PARENT'; use constant CHILD_ONLY => 99; use constant BOTH => 42.1; for my $name (qw/ PARENT_ONLY BOTH CHILD_ONLY /) { if (my $coderef = __PACKAGE__->can($name)) { my $result = $coderef->(); say "CHILD->can($name), result=$result"; } if (my $coderef = UNIVERSAL::can(__PACKAGE__, $name)) { my $result = $coderef->(); say "UNIVERSAL::can(CHILD, $name), result=$result"; } }