use strict;
use warnings;
use 5.010;
use HTML::Template qw();
use CGI qw();
my $date = 'Wed Mar 10 10:10:48 IST 2010';
my @parts = split /[ :]/, $date;
my $valueStr = <
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null || value==)
{
alert(alerttxt);
return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(rundir,Runpath must be filled out!)==false)
{
rundir.focus();
return false;}
}
}
}
SCRIPT
my @values = split /[\s\n]+/, $valueStr;
my @items;
for my $value (@values) {
next if $value !~ /_$parts[1]_/;
given ($value) {
when (/(v09.11-[a-z]\d{3})/) {
push @items, {ver => $1};
};
when (/(v09.10-[a-z]\d{3})/) {
push @items, {ver => $1};
};
when (/(v08.\d{2}-[a-z]\d{3})/) {
push @items, {ver => $1};
};
}
}
$items[0]{sel} = 'select ' if @items;
$items[$_]{sel} = '' for 1 .. $#items;
my $cgi = CGI->new ();
print $cgi->header ();
print $cgi->start_html (-script => $script);
my $str = do {local $/; };
my $template = HTML::Template->new (scalarref => \$str);
$template->param (ROW => \@items);
print $template->output ();
print $cgi->end_html ();
__DATA__