```{index} single: subname (Sub::Name) ``` ```{index} single: Sub::Name::subname ``` # subname Rename a sub in place. ## Synopsis ```perl use Sub::Name; my $named = subname 'Pkg::name', sub { ... }; ``` ## What you get back The code reference passed in, the sub now named NAME. The name is split at its last `::` or `'` into package and name; the package is created if it does not exist, and an unqualified name goes to the package of the calling code. Dies with `Not a subroutine reference`, `Undefined subroutine NAME`, or, under `strict refs`, `Can't use string ... as a subroutine ref` for a string that is not a code reference.