#!/usr/bin/perl use Device::Kiln; use Device::Kiln::Orton; use strict; use CGI; # or any other CGI:: form handler/decoder use CGI::Ajax; use Template; use Data::Dumper; my %action_table = ( graph_rm => \&graph_rm, main_rm => \&main_rm, test_rm => \&test ); my $meter = Device::Kiln->new({ width => 1024, height => 800, }); my $cgi = new CGI; my $rm = $cgi->param("rm") || "main"; $rm .= "_rm"; &{ $action_table{$rm} }($cgi,$meter); sub graph_rm ($$){ my ($cgi,$meter) = @_; my $cone = $cgi->param("cone"); print $cgi->header({-type=>'image/svg+xml'}); # print $meter->graph( { # cone => $cone, # warmuptime => $cgi->param("warmuptime"), # warmuptemp => $cgi->param("warmuptemp"), # warmupramp => $cgi->param("warmupramp"), # fullgraph => 0, # }); print $meter->graph({$cgi->Vars}) } sub main_rm ($$) { my ($cgi,$meter) = @_; my $pjx = new CGI::Ajax( 'exported_func' => \&update ); print $pjx->build_html( $cgi, \&Show_HTML); } sub update { } sub test ($$){ my ($cgi,$meter) = @_; print $meter->{test} . "\n"; } sub debug { my $msg = shift; open( my $dfh, ">>", "/tmp/kilnserver.dbg"); print $dfh (scalar localtime) . " : " . $msg . "\n"; close($dfh); } # sub Show_HTML { my $html = "
Warm Up Temp Warm Up Ramp C/Hour Warm Up Time Minutes
Fire Up Rate C/Hour Last 100C(Degrees C/hour) Cone

Time Temp
"; return $html; }