summaryrefslogtreecommitdiff
path: root/upgrade-templates.pl
blob: d6befb4f89dc0104e805c86b77b2fd17850cefd6 (plain)
  1. #!/usr/bin/perl
  2. my $dirpath = $ARGV[1];
  3. $dirpath ||= 'templates';
  4. &process_dir($dirpath);
  5. sub process_dir {
  6. my $dirpath = shift @_;
  7. opendir DIR, $dirpath || die "can't open dir $dirpath for reading:$!";
  8. my @entries = readdir DIR;
  9. closedir DIR;
  10. for $entry(@entries){
  11. my $path = "$dirpath/$entry";
  12. if (-d $path && $entry !~ /^\./){
  13. &process_dir($path);
  14. } elsif ($entry !~ /^\./){
  15. print "Processing path $path\n";
  16. `perl -ibak -pe 's|\<\%(.*)\%\>|<?lsmb \$1 ?>|g' $path`
  17. }
  18. }
  19. }