fREWdiculous!
23 Apr
So I was trying to use perltidy programmatically, that means using Perl::Tidy. Basically I wanted to use an existing .perltidyrc along with the backup option. That is, instead of making a new file with .tdy at the end, replace the original and back it up to .bak. So after reading the docs I figured that this should work:
1 2 3 4 5 6 7 8 9 10 11 | use Perl::Tidy (); use File::Spec; my $file = File::Spec->catfile( $dir, $filename ); Perl::Tidy::perltidy( source => $file, argv => '-b', perltidyrc => $perltidyrc, ); |
Unfortunately that just doesn’t work. Here’s how I got it to work:
1 2 3 4 | Perl::Tidy::perltidy( argv => "-b $file", perltidyrc => $perltidyrc, ); |
I also had to modify the .perltidyrc file some as apparently Perl::Tidy doesn’t have a way to choose who wins when there are conflicts in the switches and the config file. One way or another, it was annoying.
Maybe I was doing it wrong?
2 Responses for "Perl::Tidy: annoying facts"
You should report this as a bug to Perl::Tidy bug tracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Tidy
Also it is possible to add wishes to bug tracker.
Why not add the ‘-b’ switch directly to the .perltidyrc file? I have it set up like that and works perfectly for me.
Leave a reply