#!/usr/local/bin/perl use CGI; use CGI qw/:standard :html3 :html4 :netscape :all/; use CGI::Carp 'fatalsToBrowser'; use CGI::Push qw/:standard/; use POSIX qw/strftime/; $query = new CGI; print $query->header; print $query->start_html('Digital Markets Deal Log'); print "

Digital Markets Deal Log

\n"; # Print the first form print $query->startform; $date =(`ls FxDe* | grep -v .gz`); ################################################################################################################### # Variables ################################################################################################################### # file locking (flock): 1=shared, 2=exclusive, 8=unlocked use vars qw/$Time $Dealid $Clientid $CurrencyPair $message $line $name $date @rows/; my $file ="$date"; my $style; ################################################################################################################### print "What is the Deal ID? ",$query->textfield('name',$name,25); print "

Select The Date? ", $query->popup_menu('date',["$date"]), "

"; print $query->submit('form_1','Get Deal Info'); print $query->endform; print "


\n"; $query->import_names('Q'); if ($Q::form_1) { open(MESSAGE, "$file") || die "Couldn't open $file: $!\n"; my $locked = flock(MESSAGE,1); unless ($locked) { warn("Couldn't get lock for reading: $!"); alarm(0); close MESSAGE; return undef; } while ($line = ) { chomp $line; ($Time, $Dealid, $Clientid, $CurrencyPair) = split(/\,/, $line); if $name =~ (/$Dealid/) { unshift(@rows, table({-bgcolor=>'454B74', -border=>'0', -cols=>'2'}, Tr( td({-width=>'25%'}, strong("Time: ") ), td($Time) ), Tr( td({-width=>'25%'}, strong("Deal ID: ") ), td($Dealid) ), Tr( td({-width=>'25%'}, strong("Client ID: ")), td($Clientid) ), Tr( td({-width=>'25%'}, strong("Currency Pair: ") ), td($CurrencyPair)) ), # end table ); } # end if } } $style=< END print header(); print start_html(-title=>'', -bgcolor=>'454B74', -style=>{-code=>$style}), div({-align=>'center'}, # this table displays the entries table({-bgcolor=>'454B74', -border=>'2', -bordercolor=>'8792BD', -cols=>'2', -width=>'550', -height=>'550'}, [@rows] ), # end of table ), # end of div $locked = flock(MESSAGE,8); close(MESSAGE); exit 0; print $query->end_html; #### if $name =~ (/$Dealid/) {