-#!/usr/bin/perl -w
+#!/usr/bin/speedy -w -- -t100 -M1
use strict qw(vars);
+use CGI::SpeedyCGI qw/:standard -no_xhtml/;
use CGI qw/:standard -no_xhtml/;
sub fail ($) {
exit 0;
}
-our $R= '/var/lib/collectd/rrd/chiark.greenend.org.uk';
-our $SELF= '/home/ijackson/things/rrd-graphs';
+our (@sections, %section_groups, %group_elems, %graphs);
-my $self= url(-relative=>1);
+#---------- initialisation code, run once - graphs setup ----------
-our (@sections, %section_groups, %group_elems, %graphs);
+BEGIN {
+
+our $R= '/var/lib/collectd/rrd/chiark.greenend.org.uk';
+our $SELF= '/home/ijackson/things/rrd-graphs';
our @timeranges= (3600, map { $_*86400 } qw(1 7 28), 13*7+1, 366);
]);
}
+}
+
+#---------- right, that was the initialisation ----------
+
+our $self= url(-relative=>1);
+
if (param('debug')) {
print "Content-Type: text/plain\n\n";
}
return $v + 0;
}
-my $group= param('graph');
+our $group= param('graph');
-my $elem= param('elem');
+our $elem= param('elem');
if (defined $elem) {
my $g= $graphs{$section,$group,$elem};
die unless $g;
print h1("$title");
}
-my $detail= param('detail');
+our $detail= param('detail');
if ($detail) {
my $elems= $group_elems{$section,$detail};
die unless $elems;