Monks-
I wrote a script a long while back that would allow me to update the front page of my site with a simple HTML form. The script was working perfectly, or at least as good as it needed to be, until just recently. I've tried to recall the changes that I've made to the script since then:
- added a hash key/value
- changed method="POST to method="POST" in the HTML form
Other than those two changes, I'm almost certain I have changed nothing else. Now, however, when I run the script, my front page turns up completely blank, along with all of the backups I make prior to changing the main page. What could be causing this sudden change in the proper functioning of my script? I know this is a vague questions, but I'm baffled and have no clue what to do, as everything was working perfectly a few hours ago.
A little insight into my script, I do error checking on things like opening files, so it should tell me if the error is occuring there. Nothings shows up, so I'm assuming this isn't the problem. Shouldn't these lines of code work to backup a file?
sub back_up_file {
my ($index, $index_backup) = @_;
# open the necessary files needed for reading and writing
open (INDEX, "<$index") or die &show_error ("Unable to open $index
+: $!");
open(BACKUP, ">$index_backup") or die &show_error ("Unable to open
+ $index_backup: $!");
# write the existing file into the backup
while (<INDEX>) {
print BACKUP "$_";
}
# close the files
close (INDEX);
close (BACKUP);
}
# shows the error returned inside of the browser - easier debuging
sub show_error {
print "Content-type: text/html\n\n";
print "This is the error: <h1>$_[0]</h1>";
exit(0);
}
When I check the backup file, however, it is entirely blank. Could this be a permissions issue that my host just changed? I thought about that possibility at first, but when I run a different script that functions similarly, but on a different part of the site, everything runs smoothly as it should. Any suggestions?