Does Const::Fast work for you?
In reply to Re^7: How to safely use $_ in a library function? by tobyink in thread How to safely use $_ in a library function? by perl-diddler