print $q->header;
print $q->start_html;
while (<*.pl>) {
next if $_ eq 'replace.pl';
print "$_
";
$old = $_;
open GET, $old;
print "opening $old
";
$new = substr($old,0,(length $old) -2) . 'bak';
open PUT, ">$new";
print "opening $new
";
print PUT $_ while ;
print "writing $old into $new
";
close GET;
close PUT;
print "closing $old and $new
";
open GET, "$new";
open PUT, ">$old";
print "reopening $old and $new
";
while () {
$_ =~ s/c:\\perl\\bin\\perl/\/usr\/bin\/perl/;
$_ =~ s/\("DBI:mysql:database=foo"\)/("DBI:mysql:database=foo","bar","baz")/;
print PUT $_;
}
print "altering lines in $new and writing to $old
";
close GET;
close PUT;
print "closing $old and $new
";
$cnt = chmod 0755, $old;
if ($cnt) {
print "changing file permissions for $old
";
}
else {
print "cannot change file perms for $old
";
}
print "
";
}
print "DONE";
print $q->end_html;