%# Redirector <%init> my $path_info = substr($ENV{PATH_INFO},1) if $ENV{PATH_INFO}; my ($host, $service) = split m! / !x, $path_info if $path_info; my $conf_file = '/etc/ndash/ndash.conf'; $conf_file = $ENV{NDASH_HOME} . '/conf/ndash.conf' unless -f $conf_file; die "Cannot find config file '$conf_file'" unless -f $conf_file; my $conf = Config::Tiny->read( $conf_file ); my $nagios_url = $conf->{_}->{NAGIOS_URL} if $conf; $nagios_url = substr($nagios_url,0,-1) if substr($nagios_url,-1) eq '/'; my $location = sprintf '%s/cgi-bin/extinfo.cgi?type=2&host=%s&service=%s', $nagios_url, $host, $service; $m->redirect($location); <%once> use Config::Tiny; %# vim:ft=mason