Skip to content

Commit

Permalink
Item11808: perltidy them all, so people are not accidentally impacted…
Browse files Browse the repository at this point in the history
… by the new enforced rule

git-svn-id: http://svn.foswiki.org/trunk/BeautifierPlugin@14680 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed May 1, 2012
1 parent ad67f14 commit 54d707b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
36 changes: 16 additions & 20 deletions php/HFile/conv.pl
@@ -1,29 +1,25 @@
#!/usr/bin/perl -w

die "Usage: conv.pl <oldfile>" unless (defined $ARGV[0]);
die "Usage: conv.pl <oldfile>" unless ( defined $ARGV[0] );
$filename = $ARGV[0];

open(FIN, $filename);
open( FIN, $filename );
@lines = ();
while(<FIN>)
{
s/PSH_HFile/HFile/g;
s#global \$BEAUT_PATH;#global \$BEAUT_PATH;\nif (!isset (\$BEAUT_PATH)) return;#g;
if (s#'../PSH/HFile\.php'#"\$BEAUT_PATH/Beautifier/HFile\.php"#g)
{
push(@lines, "global \$BEAUT_PATH;\n");
}
else
{
s/PSH/Beautifier/g;
}
push(@lines, $_);
while (<FIN>) {
s/PSH_HFile/HFile/g;
s#global \$BEAUT_PATH;#global \$BEAUT_PATH;\nif (!isset (\$BEAUT_PATH)) return;#g;
if (s#'../PSH/HFile\.php'#"\$BEAUT_PATH/Beautifier/HFile\.php"#g) {
push( @lines, "global \$BEAUT_PATH;\n" );
}
else {
s/PSH/Beautifier/g;
}
push( @lines, $_ );
}
close(FIN);
open(FOUT, ">$filename");
foreach(@lines)
{
chomp;
print FOUT $_."\n";
open( FOUT, ">$filename" );
foreach (@lines) {
chomp;
print FOUT $_ . "\n";
}
close(FOUT);
9 changes: 4 additions & 5 deletions php/HFile/convall.pl
@@ -1,8 +1,7 @@
#!/usr/bin/perl -w

foreach(<*.php>)
{
print "Converting $_...";
system("./conv.pl $_");
print "Done.\n";
foreach (<*.php>) {
print "Converting $_...";
system("./conv.pl $_");
print "Done.\n";
}

0 comments on commit 54d707b

Please sign in to comment.