Just on the odd chance that you wished to automate the creation of such javascript code, for instance AJAX, you can look at
CGI::Ajax
If not, then you should inspect the modules provided in the earlier replies and if neither offer what you need you can look at any of the other 683 results a search for
javascript on cpan returns.
while ( whoring ){ for ( xp ){ grep /the source/,@perlmonks; }}