We would like to sort use statements alphabetically in the beginning of our classes automatically via perltidy or maybe other tool if available. We already use Test::PerlTidy to test if the code is formatted before committing.
I found that Perl::Tidy has the options prefilter and postfilter.
prefilter looks like the better approach, because I can sort the statements as I wish in any logical for me order, then leave it to perltidy to format it.
- Would you recommend sorting use statements? The
used classes do not depend on using one before the other. - Would you recommend using these Perl::Tidy features?
- Is there a better approach?