http://www.perlmonks.org?node_id=515683


in reply to perl deferring die to calling method

You could also use caller(). In the example bellow, I have renamed the package name from B.pm to Bb.pm -- so we don't load from the official B namespace.
package Bb; sub foo { die "your data is screwed at @{[ caller ]}" ; }