#!/usr/bin/perl
use strict;
use warnings;
#
# Convert John's final project (running on his cs:8912)
# to a form that'll run under /var/www/cs :
# (a) Copy each .mhtml file below this directory to a .html file,
#     and change .mhtml to .html in its content.
# (b) Change mhtml to html in autohandler,header,footer,nav.mas files.
#     Backup original final under .original
#
# Note that the sql stuff is all in invisible .xxx files in admin/
#
# Jim M
#
use IO::All;
for my $file  (io('.')->all(0)){   # loop over all files below this directory
  next unless $file =~ /\.mhtml$/;
  my $content < $file;
  $content =~ s/\.mhtml/.html/g;
  (my $newfile = $file) =~ s/\.mhtml$/.html/;
  $content > io($newfile);
}
for my $file  (io('.')->all(0)){
  next unless $file =~ /autohandler$|header$|footer$|nav.mas$/;
  my $content < $file;
  $content > io($file . ".original");
  $content =~ s/\.mhtml/.html/g;
  $content > $file;
}

