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

einhverfr has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to add fully declarative mappings between database functions and classes (I am also using Moo for declarative definition of properties). I would like to create a function has_dbmethod() which would have a similar syntax to has(), but would automatically generate wrapper functions for database functions. Now obviously I can't use __PACKAGE__ because I need it to be in the subclass's package, not the parent. So how can I detect the namespace of the subclass, at runtime, which calls this function?