http://www.perlmonks.org?node_id=375279


in reply to Forcing output to a browser when perl is busy

The Javscript approach is the way to go. An onSubmit handler can disable the submit button, then submit the form.

You can't do this sort of thing purely on the server side without maintining state. Since HTTP itself is is stateless (each transaction is unreleated to any other as far as the protocol is concerned) you have to build state on top, like with cookies. This adds complexity, even if you hide the gory details with things like CGI::Session. For this problem, the client side solution is simpler, even if it isn't in Perl. 8)