| 1 |
#!/usr/local/bin/perl |
| 2 |
|
| 3 |
@files = @ARGV; |
| 4 |
|
| 5 |
$^I = ".bak"; |
| 6 |
|
| 7 |
# Converts Text->new($parent) into $parent->Text() |
| 8 |
# Converts -variable => $fred into -variable => \$fred |
| 9 |
|
| 10 |
foreach $file (@files) |
| 11 |
{ |
| 12 |
print STDERR "$file:\n"; |
| 13 |
@ARGV = ($file); |
| 14 |
while (<>) |
| 15 |
{ |
| 16 |
if (/[A-Z][a-z]+->new/) |
| 17 |
{ |
| 18 |
s/([A-Z][A-Z0-9_a-z]+)->new\(\s*([^),]+)(,\s*)?/$2->$1(/; |
| 19 |
print STDERR; |
| 20 |
} |
| 21 |
if (/\b[A-Z]*VARIABLE\s*=>\s*\$/) |
| 22 |
{ |
| 23 |
s/\b([A-Z]*VARIABLE\s*=>\s*)(\$)/$1\\$2/g; |
| 24 |
print STDERR; |
| 25 |
} |
| 26 |
if (/'-[a-z]*variable'\s*=>\s*\$/) |
| 27 |
{ |
| 28 |
s/('-[a-z]*variable'\s*=>\s*)(\$)/$1\\$2/g; |
| 29 |
print STDERR; |
| 30 |
} |
| 31 |
print; |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
|