wiki:PadrePluginFix

Version 13 (modified by azawawi, 3 years ago) (diff)

--

Padre::Plugin::Fix

Uses PPI to identify and transform stuff from form A to B.

  • Over selection text range, provide the ability to quote it and choose qq{} or q{}
  • Transform if single statement into postfix form and vice versa:
if(defined $fh) {
  print "File is open";
} 

Should become

print "File is open" if defined $fh;
  • Transform qq{string} where string does not contain escape sequences into q{string} or 'string'
  • if use v5.10; or greater is used, then print "something\n" can be transformed into say "something"
  • Transform my $param1 = shift into my ($param1) = @_; and vice versa
  • if-elsif-else transformation into given-when. Please see Switch statements
if($type eq 'a') {
} elsif($type eq 'b') {
} else {
}

Should become

given($type) {
when ('a') { }
when ('b') { }
default    { }
}
  • Add Padre::Document::Perl::Beginner checks and convert them to PPI

No image "PadrePluginFix.png" attached to PadrePluginFix

TODO

  • Move beginner checks from Padre here:
    Padre::Document::Perl::Beginner
    
  • Move ::QuickFix from Padre here:
    Padre::QuickFix
    Padre::Document::Perl::QuickFix
    Padre::Document::Perl::QuickFix::StrictWarnings
    Padre::Document::Perl::QuickFix::IncludeModule
    

Resources

__END__