summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--upgrade.pl21
1 files changed, 20 insertions, 1 deletions
diff --git a/upgrade.pl b/upgrade.pl
index 88ee3674..d6befb4f 100644
--- a/upgrade.pl
+++ b/upgrade.pl
@@ -1,3 +1,22 @@
#!/usr/bin/perl
-`perl -ibak -pe 's|<\%(\.)\%>|<?lsmb $1 ?>|g' templates/*`
+my $dirpath = $ARGV[1];
+$dirpath ||= 'templates';
+
+&process_dir($dirpath);
+
+sub process_dir {
+ my $dirpath = shift @_;
+ opendir DIR, $dirpath || die "can't open dir $dirpath for reading:$!";
+ my @entries = readdir DIR;
+ closedir DIR;
+ for $entry(@entries){
+ my $path = "$dirpath/$entry";
+ if (-d $path && $entry !~ /^\./){
+ &process_dir($path);
+ } elsif ($entry !~ /^\./){
+ print "Processing path $path\n";
+ `perl -ibak -pe 's|\<\%(.*)\%\>|<?lsmb \$1 ?>|g' $path`
+ }
+ }
+}