B::Deparse
Perl compiler backend that generates Perl source code from the internal compiled structure of a program. The output won’t be exactly the same as the original program, but it will be close. Invoke as:
perl -MO=Deparse[,options
]program
program
is the name of the program
that will be deparsed. The options are comma-separated and follow
normal backend option conventions. The possible options are:
- -l
Adds
#line
declarations to the output based on line and file locations of the original code.- -p
Prints parentheses wherever they are legal, not just where they are required. Useful for seeing how Perl is parsing your expressions.
- -sletters
Provides style options for the output. In this initial release, the only style option provided is
C
, which “cuddles”else
,elsif
, andcontinue
blocks so that, for example, you would get:} else {
instead of:
} else {
The default is to not cuddle.
- -uPackage
Deparses subroutines in package Package as well as the main program, subroutines called by the main program, and subroutines in the main program. Multiple -u arguments can be given, separated by commas.
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.