package WebUtil; sub Gen_HTML { my $self = shift; # # Do stuff to make html $self->{$HTML} .= qq( html content stuff ); return($self->{$HTML}); } sub run_pjx { my $self= shift; my $pjx = new CGI::Ajax( 'exported_func' => sub { my $in = shift; return("Changed Main $in\n"); }, 'skip_header' => 1 ); my $ref_Gen_HTML = sub { $self->Gen_HTML() }; print $pjx->build_html( $self->{$WU_CGI} , &$ref_Gen_HTML ); #note should be: build_html( $cgi_object, \&callback_Function ); }