diff BoosterPack/scripts/.svn/text-base/convert_degrees.pl.svn-base @ 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/BoosterPack/scripts/.svn/text-base/convert_degrees.pl.svn-base	Mon Sep 27 16:57:26 2010 -0400
     1.3 @@ -0,0 +1,45 @@
     1.4 +#!C:/strawberry/perl/bin/perl.exe
     1.5 +
     1.6 +use strict;
     1.7 +use CGI;
     1.8 +
     1.9 +my $q = new CGI;
    1.10 +
    1.11 +print $q->header();
    1.12 +
    1.13 +if ( defined $q->param('submit') or defined $q->param('Centigrade') or defined $q->param('Kelvin')) {
    1.14 +  my $result = "";
    1.15 +  if ( defined $q->param('Centigrade') and $q->param('Centigrade') ne "") {
    1.16 +    $result = $q->param('Centigrade') + 273.15;
    1.17 +  } elsif ( defined $q->param('Kelvin') and $q->param('Kelvin') ne "" ) {
    1.18 +    $result = $q->param('Kelvin') - 273.15;
    1.19 +  }
    1.20 +  print $result;
    1.21 +} else {
    1.22 +  print &Show_Form();
    1.23 +  print &Show_Footer();
    1.24 +}
    1.25 +
    1.26 +sub Show_Form {
    1.27 +  my $html = "";
    1.28 +  $html .= <<EOT;
    1.29 +<HTML>
    1.30 +  <HEAD><title>Temperature Conversion</title>
    1.31 +</HEAD>
    1.32 +<BODY>
    1.33 +  <form>
    1.34 +  Temperature =<br>
    1.35 +  <input type="text" name="Centigrade" size="10"> degrees C<br>
    1.36 +  <input type="text" name="Kelvin" size="10"> degrees K<br>
    1.37 +  <input type="submit" name="submit" value="Convert">
    1.38 +  <input type="reset"><br>
    1.39 +  </form>
    1.40 +EOT
    1.41 +
    1.42 +  return $html;
    1.43 +}
    1.44 +
    1.45 +sub Show_Footer {
    1.46 +  print "</body></html>\n";
    1.47 +  return;
    1.48 +}