Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

RE: Re: how to indent/pretty print perl code

by ZZamboni (Curate)
on Nov 02, 2000 at 21:20 UTC ( #39690=note: print w/ replies, xml ) Need Help??


in reply to Re: how to indent/pretty print perl code
in thread how to indent/pretty print perl code

This is very cool, clemburg. ++ for that. I was going to comment about cperl-mode, but I didn't know how to automate the process. Thanks!

Just for the sake of completeness, be aware that cperl sometimes breaks with funky perl code such as regexes, here documents, unusual quoting and things like that. But other than that it's an excellent way of doing it.

For printing Perl code, I usually use xemacs' "pretty-print" option, which is loaded with some package I can't remember right now. I don't know how to invoke it in batch mode though - you have to manually load the file and select the option from the menu. Pretty-print generates postscript according to your current font-lock settings, so you get colors (shading in a b/w printer), bold, etc.

--ZZamboni


Comment on RE: Re: how to indent/pretty print perl code
RE: RE: Re: how to indent/pretty print perl code
by clemburg (Curate) on Nov 02, 2000 at 21:30 UTC

    Yup, you are right about cperl mode. It's just that I don't know a better replacement. In my experience, nearly all modes for Perl break on complicated constructs (this is BTW a good incentive to keep your Perl readable).

    If you can find out where this "pretty-print" option comes from, it should not be hard to automate it, too - I will be glad to help (though I don't use xemacs, but GNU emacs, and pretty-print is not there in my emacs :-( ... might be the incentive to go for xemacs?).

    Christian Lemburg
    Brainbench MVP for Perl
    http://www.brainbench.com

      I think the package is ps-print.el (I'm from a remote terminal right now, so I can't check thoroughly), and it says it belongs to GNU Emacs, so I would assume it is present there too. When I read the file I assumed it would only work from interactive mode because it says it needs a font-lock package. But if you figure out how to make it work from batch mode, please let me know :-)

      --ZZamboni

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://39690]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-09-21 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (173 votes), past polls