sub handler { my $r = shift; # use the path_info to determine which template file to process my $file = $r->unparsed_uri; # validate the url as a content page my $tt_path = $nav->get_path_attribute("/$file", 'local_path'); $tt_path =~ s[^/][]; return -1 if ! $tt_path; # Decline this request if the path isn't in the nav # set up and call the template my $template = Template->new({ PLUGIN_BASE => 'MyOrg::Template::Plugin', INCLUDE_PATH => "$websrc:$websrc\\lib", PRE_PROCESS => 'config', OUTPUT => $r, # direct output to Apache request }); my $params = { uri => $r->uri, navigation => $nav, }; $r->content_type('text/html'); $r->headers_out->add('Set-Cookie' => "CGISESSID=PLEASEWORK; path=/"); $template->process($tt_path, $params) || return fail($r, 500, $template->error()); ## 500 -> SERVER_ERROR return 0; # OK }