summaryrefslogtreecommitdiff
path: root/upgrade-templates.pl
blob: 49bf0e0168f8ae7bce99481e61483877be4307d3 (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. }
  15. elsif ( $entry !~ /^\./ ) {
  16. print "Processing path $path\n";
  17. `perl -ibak -pe 's|\<\%(.*?)\%\>|<?lsmb \$1 ?>|g' $path`;
  18. }
  19. }
  20. }