my $pjx = CGI::Ajax->new(first => \&first_handler, second => \&second_handler); sub first_handler { ... } sub second_handler { ... }