Unless you have a very compelling reason to stick with IO::Socket modules, have a look at HTTP::Daemon in the LWP Bundle. I moved to that and things are much, much easier.
If you're supremely curious, have a look at some example code for how we've set things up.