in reply to Peculiar (but probably expected) CGI::Ajax and CGI::Application problem

The error you mention is triggered in CGI::Ajax::insert_js_in_head, and it means that the necessary javascript can't be inserted into your html document.

I think the error is caused by your passing a reference to the template output. The way I understand the CGI::Ajax docs, you should either pass a coderef, or a string, to build_html. The quick fix to your code is therefore:

sub main { my $self = shift; my $q = $self->query; # the CGI object my $tmpl = $self->load_tmpl( 'main.tmpl' ); $pjx->build_html( $q, $tmpl->output ); # <-- no reference }