If you're not constrained to using CGI, look at Dancer2. (or Mojo, whatever, we need a macro to suggest both simultaneously). CGI::SpeedyCGI is also an option for persistence in constrained environments. I know, it's old. You'd be surprised to hear who still uses it.