in reply to CGI Authenticaiton
it's more the method I am struggling with.
So, you've got these great, well tested libraries of code, but you're having trouble getting them to all work together. Its the same problem we've all faced our first time trying to build a performant, reliable web service. Thankfully, the many before us have helped us solve this problem too.
Check out CGI::Application. This library provides a framework and conventions so the other libraries you've mentioned have a very basic use case. With this library, you get plugins like CGI::Application::Plugin::Authentication, so you almost don't even have to think about the seemingly simple / deceptively difficult task of authorizing a person to access a resource on the web. Heck, it even gives you a login form so you don't even have to write html. If the defaults suit your tastes, you're not even really writing code, you're just doing configuration.
In other words, you're looking at the right tools, but there are even more tools out there that make it easy to use these tools. Even if you're unsure how to use these tools right away, keep at it. Its a near certainty that using these tools are going to give you a cleaner, less buggy, more secure implementation.