in reply to Debug a long-running CGI script?
You can trace your program flow, to detect where it stops. You can write to STDERR and then analyse webserver logs. You can write log to a file. You can use very good module Log::Log4perl