#! perl # mandatory # implements the doclet exti request, to serve cfhtml strings our %DOCLET; # $DOCLET{category} = $cb sub register($$) { my ($category, $cb) = @_; $DOCLET{$category} = $cb; Guard::guard { delete $DOCLET{$category} } } cf::register_async_exticmd doclet => sub { my ($ns, $reply, $category, $entry) = @_; cf::async { my $cfpod; if (my $pl = $ns->pl) { if (my $cb = $DOCLET{$category}) { $cfpod = $cb->($pl, $category, $entry); } else { $cfpod = "No documentation found for $category/$entry."; } $cfpod = $pl->expand_cfpod ($cfpod); } else { $cfpod = "(Documentation not available before login.)"; } $reply->($cfpod); }; };