Code::Explain - Try to explain what $ @ % & * and the rest mean
my $ce = Code::Explain->new; $str = '$x ||= $y'; print $ce->explain($str), "\n";
or
@ppi_dump = $ce->ppi_dump($str);
The module comes with a command line tool called
explain-code
You give a perl expression to it and it will give an explanation what that might be.
One of the following:
--explain Try to exaplain our way --ppidump Run PPI on the code and print the dump --ppiexplain Run PPI on the code and try to explain the individual tokens --all All of the above --help Prints the list of command line options
This is pre-alpha version (whatever that means) of the code explain tool. It should be able to understand various perl constructs such as.
$x ||= $y; @data = map { ... } sort { ... } grep { ... } @data;
give a short explanation and reasonable pointers to the documentation.
See the t/cases.txt file more cases that are already handled. Add further cases to t/todo.txt, preferably with some explanation.
Gabor Szabo http://szabgab.com/
This software is copyright (c) 2011 by Gabor Szabo.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Code::Explain, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Code::Explain
CPAN shell
perl -MCPAN -e shell install Code::Explain
For more information on module installation, please visit the detailed CPAN module installation guide.