Is there some way of connecting the AJAX to more than one subroutine, rather than having only the "&main" option?
Sure, that's no problem. When you initially create the CGI::Ajax instance, you can pass in as many "js_call_name => perl_coderef" pairs as you like. e.g.,
my $pjx = CGI::Ajax->new(first => \&first_handler, second => \&second_
+handler);
sub first_handler { ... }
sub second_handler { ... }
Note that you still call
build_html in the exact same way - this is set up when the CGI::Ajax object is created, not when it's used.