I'm not convinced your endeavour is worthwhile, but I did find a problem.
Assuming it works at all, unslice executes too late in
unslice 'SomeModule'; use SomeModule;
It needs to be
BEGIN { unslice 'SomeModule'; } use SomeModule;
A better syntax might be
no slice 'SomeModule'; use SomeModule;
Further more, your slice isn't constant. You might as well remove the prototype. Using the () prototype is not enough to make a constant. The body of the function must also be constant. From perlsub:
Functions with a prototype of () are potential candidates for inlining. If the result after optimization and constant folding is either a constant or a lexically-scoped scalar which has no other references, then it will be used in place of function calls made without &.
In reply to Re: Cheaper - Debug,Log,Errors via Slicing&dicing
by ikegami
in thread Cheaper - Debug,Log,Errors via Slicing&dicing
by rootcho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |