Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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.


  • Comment on RE: Re: how to indent/pretty print perl code

Replies are listed 'Best First'.
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

      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 :-)


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://39690]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2017-11-21 06:34 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (296 votes). Check out past polls.