-l=78 -i=4 -ci=4 -se -vt=2 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nsfs -nolq -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
If you put that into ~/.perltidyrc you're all set.
It's rumored that any patch submitted which is the result of running that against a particular file will automatically be approved.
Emacs users can add the elisp code found on the CPerl Mode Page EmacsWiki's and call this from within the editor on regions and functions. The pertinent text is included below for convenience, but /you should really check the Emacs Wiki to be sure there isn't fresher, tastier stuff available/
Is there a way to get it to work consistently with http://perltidy.sourceforge.net/?
Yes, a way (but not a single way to do it) from the perltidy documentation itself :
“For the emacs editor, first mark a region and then pipe it through perltidy. For example, to format an entire file, select it with C-x h and then pipe it with M-1 M-| and then perltidy. The numeric argument, M-1 causes the output from perltidy to replace the marked text. See ``GNU Emacs Manual for more information, http://www.gnu.org/manual/emacs-20.3/html_node/emacs_toc.html
If you have difficulty with an editor, try the -st flag, which will force perltidy to send output to standard output. This might be needed, for example, if the editor passes text to perltidy as temporary filename instead of through the standard input. If this works, you might put the -st flag in your .perltidyrc file.”
These functions can be used to get quick access to perltidy:
(defun perltidy-region () "Run perltidy on the current region." (interactive) (save-excursion (shell-command-on-region (point) (mark) "perltidy -q" nil t))) (defun perltidy-defun () "Run perltidy on the current defun." (interactive) (save-excursion (mark-defun) (perltidy-region)))