Maybe you would find Moose an interesting alternative to get the result you want (portable between 5.10 and 5.12). Check out Moose::Manual::MOP specifically and for a broader introduction Moose::Manual.
Comment on Re: How to get function's name inside of CODE attribute