#!/usr/bin/perl
# n.cgi
use strict;
use CGI qw( :standard );
use CGI::Carp qw( fatalsToBrowser );
use POSIX qw(strftime);
my $today = time;
my $yesterday = $today - 60 * 168 * 60;
my $FM = strftime "%m-%d-%Y", ( localtime($yesterday) );
my $TM = strftime '%m-%d-%Y', localtime;
# page layout
my $page =<< "EndOfText";
Add Logical:
EndOfText
# construct URL
my $URL = 'http://a.com:8080/bms/healthMonitor.do?method=redirect'
.'&operation=BackupHistorySearch'
.'&subOperation=GetReport'
."&fromDateStr=$FM&toDateStr=$TM";
# javascript
my $JSCRIPT=<new;
my $action = $q->param('action');
my $server = $q->param('server');
# add server
$URL .= "&clientName=$server";
# redirect if required
if ($action eq 'Search'){ # remove hash to redirect
print $q->redirect($URL);
} else {
print $q->header,
$q->start_html( -title => "Some Title",
-script=> $JSCRIPT),
$page,
$q->end_html;
}