Unsure how to wrap JSON result with <textarea> using jquery.form.js for file upload

Unsure how to wrap JSON result with <textarea> using jquery.form.js for file upload

I like this plug-in by Mike Alsup , but I'm not sure when, where or how to return the JSON with the <textarea> as recommended by the author. HERE'S THE CAVEAT: I'M USING PERL (stop the groaning) and a CGI::Application plugin for JSON. The example in his doc uses PHP, but can't connect the dots.

Thanks!

P.S. I just found jquery.ajax_postup.js which looks easier. Any users out there?

Here's my code reduced to the bear essentials:
  1. HTML:
    <form id="slides" action="/xmpx/slides.cgi" method="post" enctype="multipart/form-data">  
       <input type="file" name="upload_image" id="upload_image" />
       <input type="submit" value="Submit" class="button" />
    </form>





  2. JQUERY:
    $('#slides').ajaxForm({
       beforeSubmit:  function(a,f,o) {
                         $('#msgs').html('Submitting...');
                      },
       datatype: "json",
       success: function(result){
                   parse_results(result,$('form[id]','msgs'));
                }, //success
    });//ajaxForm 
      











  3. PERL:
    use CGI::Application::Plugin::JSON ':all';
    my $result = [{ 'messages' =>
                                  [{ 'upload_image' => 'File is too large to upload.' }]
                 }];
    return $self->json_body( $result );








  4. RETURN SHOWN IN FIREBUG:
    [{"messages":[{'upload_image' => 'File is too large to upload.'}]}]
      



  5. REFERENCE:  
    //javascript called after success: 
    function parse_results(result,form, msgdiv) {
       var success = '', ctr = 0;
       var msgArray = result[0].messages;
       $.each(msgArray, function(i,o) {
             var val = o[p]; //p is the key or id in this case, and val is the message
             if (p == 'success') {
                if (val != "1") {
                   success += '<p class="success">' + val + '</p>';
                   ctr+=1;
                }
                ...