sub foo { my $self = shift; croak "I am an instance method" unless $self and ref $self and $self->isa(__PACKAGE__); # actual body of code } #### method sub {} # $SELF=shift, check $SELF & isa instance method sub {} # =method modifier + ref $SELF class method sub {} # =method modifier + !ref $SELF & /\W/ & defined namespace