|Do you know where your variables are?|
Re: Should I write your code ?by tachyon (Chancellor)
|on Mar 16, 2002 at 14:37 UTC||Need Help??|
Should I give you hints, or should I write your code?
This is completely your choice. Your hint (check the result of rename and print the error in $! was excellent and got a ++ Give a man a fish and he will eat today. Teach a man to fish and he shall eat forever. On the other hand your example code was broken and got a -- When I noted that it had quite a high reputation it also got a direct reply to you. I feel if you post code it should work properly otherwise it does no one any good
Trying to rename a file, and failing to do so (for any reason), should result in an error message, and should not be quietly dismissed.
You are of course correct. While throwing an exception with die is one way of dealing with errors it is usually not a good way in a CGI. I usually have a die_nice() function in my CGIs that looks something like:
One problem with a simple print is that without a valid header a CGI will fall over with a 500 internal server error.
You seem to have taken it a little to heart so may be amused to find that I have posed similar questions to yours at What's a fair thing? and So it's homework - so what? All the best and keep up the good work. ++ for this one BTW.