The best way to debug problems like this is to look at it from the client side, using a debugger such as Firebug, the Developer menu in Safari, etc.   Look at the actual content of the HTTP message that is being sent and received in each case. Now, locate a web-site that now does what you want it to do, and compare the two exchanges. Now you know, not only what the Perl code you’ve written is actually doing, but what it needs to do. This gives you a specific target to shoot for ... and if the perldocs don’t tell you, the source-code will.