in reply to CGI::Application, call another runmode then return
I use the CGI::Application portion (and its associated concept of “runmodes”) strictly as an initial method of identifying and then dispatching the original web request ... nothing more or less. From that point forward, “it’s just Perl.”
Furthermore, it is very helpful to have other, background processes to whom you can delegate potentially time-consuming tasks such as sending e-mails. Package up a record describing the request, then write it to a pipe somewhere. Arrange for another process, somewhere else, to be standing around, listening on that pipe and doing what it’s told. This keeps the web-server itself “lean and mean,” able to handle a large volume of requests because gets each one done quickly. If a backlog builds up, it will be (stored) in the pipe, and the pipe-listener process(es) will eventually chow through it.