#!/usr/bin/perl -w ########################################### # Mike Schilli, 2006 (m@perlmeister.com) ########################################### use strict; use CGI qw(:all); use DB_File; use Template; my %states = ( idle => 'green', check => 'yellow', busy => 'red', ); tie my %store, "DB_File", "data/phonewatch.dat" or die $!; $store{state} = "idle" unless defined $store{state}; print header(); my $new = param('state'); if($new and exists $states{$new}) { $store{state} = $new; } my $tpl = Template->new(); $tpl->process(\ join('', ), { bgcolor => $states{$store{state}}, state => $store{state}, self => url(), }) or die $tpl->error; ########################################### __DATA__

Phone Monitor

[% IF state == "idle" %] [% END %]
Status: [% state %] check