Class::method($self); # called as a subroutine $self->method; # called as a method #### use Devel::Caller qw(called_as_method); sub foo { my $self = shift; croak "I am an instance method" unless called_as_method(0); # actual body of code }