The first sounds complicated. The second is possible. Jellybean does it, POE could do it, and Matts has something called PPerl that might do the trick. (I don't know if he's put it up on the CPAN yet.)
Comment on Re: perl-based server for use by CGI scripts.