Вот мой простой код:
Код: Выделить всё
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
# Enable taint mode
use diagnostics;
print "Content-type: text/html\n\n";
# print header(-type => 'text/html', -charset => 'utf-8').
# start_html('Form Submission Results');
my $sequence = param('sequence');
my $alignment_type = param('alignment-type');
my $organism = param('organism');
my $sequence_length = param('sequence-length');
my $confidence_level = param('confidence-level');
# Check for missing data
if (!$sequence || !$alignment_type || !$organism || !$sequence_length || !$confidence_level) {
print h1("Error: Missing Data");
print p("Please fill all the fields.");
print end_html;
exit;
}
# Basic validation (simulating complex processing)
if ($sequence !~ /^[ACGT]+$/i) {
print h1("Error: Invalid Sequence");
print p("Sequence must contain only A, C, G, or T for DNA.");
print end_html;
exit;
}
# Simulate processing
print h1('Sequence Alignment Results');
print p("Alignment Type: $alignment_type");
print p("Organism: $organism");
print p("Sequence Length: $sequence_length");
print p("Confidence Level: $confidence_level");
print end_html;
Подробнее здесь: https://stackoverflow.com/questions/790 ... -cgi-qwsta