Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict;
- use warnings;
- use CGI qw(:standard);
- my $particle = param("particle");
- my $charge = param("charge");
- my $frequency = param("frequency");
- my $nmrtable_data = "/usr/local/lib/nmrtable_data";
- my $line;
- # Constants
- my $M_zero = 1876.5592;
- sub calculate_frequency {
- print p("In the sub");
- open (file_handle, "<$nmrtable_data") or die qq(Unable to open "$nmrtable_data");
- foreach (<file_handle>) {
- if (($_ =~ /$particle/) and ($_ =~ /$charge/)) {
- print p($_);
- }
- }
- }
- print header, start_html(-title=>"EAL Energy Calculator",
- author=>"leblanc\@ohio.edu");
- print '<STYLE type="text/css">';
- print ' H1.myclass {border-with: 1; border: solid; test-align: right;}';
- print '</STYLE>';
- print '<H1>EAL Energy Calculator</H1>';
- if ($frequency eq "") {
- print hr, start_form;
- print p("Please select particle: ", popup_menu("particle",
- ['PROTONS','DEUTERONS','HELIUM-3','ALPHAS',
- 'LITHIUM-6','LITHIUM-7','BORON-10','BORON-11',
- 'CARBON-12','CARBON-13','NITROGEN-14',
- 'NITROGEN-15','OXYGEN-16','ALUMINUM-27']));
- print p("Please select charge state: ", popup_menu("charge",
- ['+1','+2','+3','+4','+5','+6','+7','+8']));
- print p("Please enter NMR Value (in MHz): ",textfield("frequency",""));
- print p(submit("Calculate"), reset("Clear"));
- print end_form, hr;
- } else {
- print hr, start_form,p;
- print "<TABLE>";
- print "<TR><TH>Particle:<TD><big><b><font size=+1 color=#0000ff>$particle</font></b></big></TR>";
- print "<TR><TH>Charge State:<TD><big><b><font size +1 color=#0000ff>$charge</font></b></big></TR>";
- print "<TR><TH>Energy (MeV):<TD><b><font size=+1 color=#0000ff>$frequency</font> </b></TR></TABLE>";
- calculate_frequency();
- # print p("$nmrshow"),hr;
- print p(defaults("Continue"));
- print end_form;
- $frequency = undef();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement