Expand description
Refactoring and modernization helpers. Subroutine inlining for Perl code.
Provides text-based subroutine inlining that replaces a call site with the function’s body after substituting formal parameters with the actual arguments from the call.
§Limitations
This is a text-pattern implementation. It does not build a full AST and therefore relies on heuristics for:
- Parameter extraction (assumes
my ($a, $b, …) = @_;pattern) - Return detection (counts
returnkeywords) - Recursion detection (looks for the sub name inside the body)
- Side-effect detection (looks for
print,warn,die,open,close,write,read,seek,sysread,syswrite)
Functions that do not follow these conventions may not be inlined correctly. The safe defaults are to reject when uncertain (recursion, large body, multiple returns) and to warn when side effects are detected.
Structs§
- SubInliner
- Text-based Perl subroutine inliner.
Enums§
- Inline
Ability - The result of analysing a subroutine’s inlineability.
- Inline
Error - Error type returned by subroutine inlining operations.
Functions§
- analyze_
sub_ for_ inlining - Analyse whether a named subroutine can be inlined.