What’s wrong with this picture:
open(OUTFILE,">${tmpdir}${code}");
print OUTFILE $scode;
close(OUTFILE);
Well, it may not be my style. But, the biggest problem is What happens if the OUTFILE isn’t created?
I ran into this when my security codes weren’t working. There was no bad output, other than a glimpsing error that I saw on a screen saying that there was something up with the print OUTFILE $scode line.
The problem was that the $tmpdir had gotten bad permissions.
It would be a lot nicer if we had:
open OUTFILE, “>${tmpdir}${code}” or die “I guess I should tell someone that this didn’t work. opening ${….}: $!”;
I always like to run my scripts with -w, use strict; etc… like a good boy. This had me change mt-scode.cgi too:
#my $cookie = $cgi->cookie(-name=>’code’,-value=>$code);
$cookie doesn’t seem to be used anymore and -name=>code was bare instead of quoted anyway.
Now everyone is happy, and the codes are back :)

February 5th, 2005 at 11:28 am
I’ve seen that happen as well with MT. At some point, my weblog stopped working completely and it took me a while to realize that mt.cgi had been chmod’ed 000 owned by root.
I think the MT code has quite a few bugs and can leave things in an inconsistent state if things go wrong.
February 5th, 2005 at 11:28 am
I’ve seen that happen as well with MT. At some point, my weblog stopped working completely and it took me a while to realize that mt.cgi had been chmod’ed 000 owned by root.
I think the MT code has quite a few bugs and can leave things in an inconsistent state if things go wrong.
February 5th, 2005 at 12:12 pm
Posting perl code Dion, for shame :-)
I think this is a good example on why exceptions are good. It also shows the difficulty with supporting a notion like ‘bare words’ in a language. Groovy should take note of this with their builder idea, and hopefully they’ll have a ’strict’ mode as well.
February 5th, 2005 at 12:12 pm
Posting perl code Dion, for shame :-)
I think this is a good example on why exceptions are good. It also shows the difficulty with supporting a notion like ‘bare words’ in a language. Groovy should take note of this with their builder idea, and hopefully they’ll have a ’strict’ mode as well.