Update: Apache::PrettyPerl is a mod_perl module to turn Perl code into syntax-highlighted HTML on the fly. It might be worth a look, too.
I've seen hacks that use the C formatter indent, but nothing's done a great job with it. The problem is that Perl is so bloody flexible, it's possible to write code that doesn't look like code to most pretty-printers.
The a2ps program claims to handle Perl, but I don't know how well.
There are two in-Perl solutions. The first is the B::DeParse module, which takes the compiled form of your program and spits it back out as Perl code. This takes some guesswork, though, as your program is seen after Perl has optimized it. The module is still under development, so feel free to fix any bugs you find :-)
The second solution is to write your own. Good luck! A good place to start might be the Text::Balanced module. It's not as heavyweight as Parse::RecDescent. Perl is a complicated beast, but you might be able to do rudimentary parsing using either module.
Let us know how the search goes. I'm sure many others would like a Perl pretty-printer.
In reply to RE: Re: Parsing Perl in Perl
by gnat
in thread Parsing Perl in Perl
by awwaiid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |