annotate BoosterPack/scripts/convert_degrees.pl @ 0:0d795f02a8bb tip

initial committ. what was I thinking?
author Robert McIntyre <rlm@mit.edu>
date Mon, 27 Sep 2010 16:57:26 -0400
parents
children
rev   line source
rlm@0 1 #!C:/strawberry/perl/bin/perl.exe
rlm@0 2
rlm@0 3 use strict;
rlm@0 4 use CGI;
rlm@0 5
rlm@0 6 my $q = new CGI;
rlm@0 7
rlm@0 8 print $q->header();
rlm@0 9
rlm@0 10 if ( defined $q->param('submit') or defined $q->param('Centigrade') or defined $q->param('Kelvin')) {
rlm@0 11 my $result = "";
rlm@0 12 if ( defined $q->param('Centigrade') and $q->param('Centigrade') ne "") {
rlm@0 13 $result = $q->param('Centigrade') + 273.15;
rlm@0 14 } elsif ( defined $q->param('Kelvin') and $q->param('Kelvin') ne "" ) {
rlm@0 15 $result = $q->param('Kelvin') - 273.15;
rlm@0 16 }
rlm@0 17 print $result;
rlm@0 18 } else {
rlm@0 19 print &Show_Form();
rlm@0 20 print &Show_Footer();
rlm@0 21 }
rlm@0 22
rlm@0 23 sub Show_Form {
rlm@0 24 my $html = "";
rlm@0 25 $html .= <<EOT;
rlm@0 26 <HTML>
rlm@0 27 <HEAD><title>Temperature Conversion</title>
rlm@0 28 </HEAD>
rlm@0 29 <BODY>
rlm@0 30 <form>
rlm@0 31 Temperature =<br>
rlm@0 32 <input type="text" name="Centigrade" size="10"> degrees C<br>
rlm@0 33 <input type="text" name="Kelvin" size="10"> degrees K<br>
rlm@0 34 <input type="submit" name="submit" value="Convert">
rlm@0 35 <input type="reset"><br>
rlm@0 36 </form>
rlm@0 37 EOT
rlm@0 38
rlm@0 39 return $html;
rlm@0 40 }
rlm@0 41
rlm@0 42 sub Show_Footer {
rlm@0 43 print "</body></html>\n";
rlm@0 44 return;
rlm@0 45 }