Download Padre

Perl Tidy

Description

The CPAN package Perl::Tidy provides a command line tool to process and reformat a Perl 5 script or module.

Padre has a plugin called Padre::Plugin::PerlTidy that provides integration with the above module. It uses the default settings of perltidy or the settings of the current project to tidy the current file or the current selection in the editor.

Test

  1. Create a new document and paste in the following:
          if ( $x eq $y     ) { print 1;
          }
        
  2. Click on Tools/Perl Tidy/Tidy the Active Document
  3. The output window at the bottom is opened and the following is printed:
          Perl::Tidy running with default or user configuration }}}
        
  4. The content now looks like this:
          if ( $x eq $y ) {
          	print 1;
          }
        

TODO: saved file, redo change,

TODO

  • A GUI tool to configure the settings of perltidy (there is very limited implementation already)
  • Allow the user to set "tidy-on-save" so when a file is saved first it goes through a tidy process