views:

88

answers:

2

I'm using Eclipse combined with EPIC to write my Perl code. I configured EPIC to use Perltidy with "-pbp" (perl best practices style) to format my code.

This doesn't work well when using Method::Signatures' named parameters. E.g., func (:$arg1, : $arg2) is formatted as func (: $arg1, : $arg2) which yields an error.

Also, func keyword is not recognized like sub so indentation is wrong.

Related to this previous unanswered question and this cross post.

+2  A: 

You can't, unless you make PPI, which is what Perltidy uses for most of its work, aware of the various signature modules such as MooseX::Method::Signatures, Method::Signatures::Simple, or Method::Signatures.

A reasonable workaround might be to not run Perltidy on all of your code, but only on the chunks of it you've just written and want formatted in some way. That way you can easily skip running it on any method signatures and have it process only the method bodies instead.

rafl
I'm so used to `Alt+Ctrl+F` (autoformat all) and like it. I'll be really sad to give up on it.
David B
So would I. Though, sadly, the only alternatives I can see are 1) giving up on automatically formatting /all/ of your code without consideration, 2) giving up on parts of method signatures, or 3) doing some work on PPI. Your choice.
rafl
perltidy does NOT use PPI - it has it's own parser
Alexandr Ciornii
+2  A: 

Perl::Tidy/perltidy does not make use of PPI, it predates PPI by about 9 years ( http://sourceforge.net/projects/perltidy/ says Registered: 2000-12-23 )

slick
http://search.cpan.org/dist/Perl-Tidy/META.yml proves that the current release also did not migrate to PPI.
daxim