http://qs321.pair.com?node_id=1136285


in reply to Getting constructor caller in Mo/Moo/Moose BUILD/BUILDARGS

Carp does something similar (with the idea that when you provide a module that someone uses incorrectly, you want to tell that person where their mistake is, rather than about the internals of your module). So you may want to look there. After a quick look the sub short_error_loc may be the one that does what you want, as it iterates through callers until it finds a package that isn't "trusted" (parent packages, packages in the trust list, and packages trusted by those ones).