Perl is for delivering things to the browser. Once on the browser, it's all about JavaScript. You would remain much saner if you separated your concerns between services provider and client. The client can be anything (a browser, library, etc) - but you're limited to JavaScript based solutions on the browser. I'd look heavily into REST and providing an API on the server side. As I said, if the REST API is decent, you can write a client in anything - so for example, you could bypass the browser altogether and write a nifty GUI client using Perl + some bindings for a Tk or some other GUI library.