in reply to Re^4: missing outputs
in thread missing outputs

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 = <<VALS; Fri_Jan_29_14:30:22_v09.11-e024_1 Wed_Jan_27_14:30:11_v09.11-e022_1 Mon_Mar_08_14:30:04_v09.11-s008_1 Thu_Jan_28_14:30:13_v09.11-e023_1 Tue_Nov_24_15:54:18_v09.11-e005_1 Tue_Mar_01_14:30:08_v09.10-p002_1 Tue_Nov_24_17:31:07_v09.10-p001_1 Wed_Nov_25_10:27:43_v09.11-e002_1 Wed_Mar_25_10:27:43_v08.11-e002_1 VALS my $script = <<SCRIPT; <script language='Javascript'> 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 ou +t!)==false) { rundir.focus(); return false;} } } } </script> 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 $/; <DATA>}; my $template = HTML::Template->new (scalarref => \$str); $template->param (ROW => \@items); print $template->output (); print $cgi->end_html (); __DATA__ <form name='form1' action='XXXXXX' method='POST' onsubmit=return valid +ate_form( this)> <div align=center> <table cellpadding=10> <tr> <td> <font color='CC3300'><b>Enter rundir path</b>:</font> </td> <td> <input type=text name=rundir size=50 onChange=valid_data(this.name +)> </td> </tr> <tr> <td> <font color='CC3300'><b>Select Version</b>:</font> </td> <td> <form name=options action=XXXXX method='GET'> <select name=version Version><TMPL_LOOP NAME=ROW> <option <TMPL_VAR NAME=SEL> value="<TMPL_VAR NAME=VER>"><TMPL_ +VAR NAME=VER></option></TMPL_LOOP> </select> </form> </td> </tr> <tr> <td></td> <td> <input type=submit value=Submit /> </td> <tr> <td></td> <td> <form name=user_log action=XXXXX method=POST> <input type=submit name=submit value=User Log> </form> </td> </tr> </table> </div>

Obviously the template (in the __DATA__ section) and probably the script too, should be stored in an external file or pulled from a database. You might want to take a look at the documentation for the various modules that I've used - they do a lot of good magic.


True laziness is hard work