If you are not redirected automatically, follow the Home

I used to do the Hokey Pokey...
But I turned myself around. #!/usr/bin/perl use Conference; use CGI_Lite; use Time::JulianDay; use Time::ParseDate; use Time::DaysInMonth; use Time::CTime qw(:DEFAULT @MonthOfYear); use DBI; use Text::Template; use strict; my ($config, $cgi, $dbh, $form, %Actions, $routine, $template, $details, $fill_in, $filled, ); $config = new Conference; $cgi = new CGI_Lite; $dbh = DBI->connect($config->database, $config->DBI_username, $config->DBI_password, $config->DBI_arg); $dbh->{'LongReadLen'} = 6000; print "Content-type: text/html\r\n\r\n"; $form = $cgi->parse_form_data; %Actions = (Default => \&Display, Display => \&Display, Details => \&Details, Jump => \&Jump, Find => \&Find, ); $routine = (defined($Actions{$form->{action}})) ? $Actions{$form->{action}} : $Actions{Default} ; ($template, $details) = $routine->($config, $cgi, $form, $dbh); $fill_in = new Text::Template ( TYPE => 'FILE', SOURCE => $config->templates . "/" . $template . ".html"); $filled = $fill_in->fill_in( HASH => [ $config, $form, $details ], DELIMITERS => [ '[##', '##]' ] ); print $filled; $dbh->disconnect; ############################# sub Display { # Display the events for 'today'. my ($config, $cgi, $form, $dbh) = @_; my ($template, $details, @reservations, $reservation, $room, $hour, $reserve, $duration, $Data, $todaytime, $i, %Table, @Times, %Rooms, $sth, ); @Times = @{$config->Times}; $form->{today} ||= local_julian_day(time); $todaytime=jd_secondslocal($form->{today},0,0,0); $details->{reserve_link} = $config->base_url . "/" . $config->reserve. "?action=Reserve&today=$form->{today}"; $details->{today_text} = strftime('%A, %B %o, %Y', localtime($todaytime)); $details->{day} = strftime('%d', localtime($todaytime)); $details->{year} = strftime('%Y', localtime($todaytime)); $details->{yesterday} = $form->{today}-1; $details->{tomorrow} = $form->{today}+1; $details->{script_name}= $config->user; # Get all of today's reservations $sth=$dbh->prepare("select * from reservation where day=$form->{today} "); $sth->execute; while ($Data = $sth->fetchrow_hashref) { for ($Data->{start}..$Data->{end}-1) { $Table{$Data->{room}}->{$_} = $Data; } # End for } # Wend # Get the rooms $details->{table} = "\n"; $sth=$dbh->prepare("select * from room2 order by room"); $sth->execute; while ($Data = $sth->fetchrow_hashref) { $Rooms{$Data->{room}} = $Data->{ID}; $details->{table} .= qq~$Data->{room}\n~; } $details->{table} .= "\n"; for $hour (0..@Times) { $details->{select_time} .= "

$Table{$room}->{$hour}->{title}
~; } else { # Do nothing } # End if ... else } else { $details->{table} .= "\n" } # End if defined } # End for room } # End for hour $details->{month} = strftime('%m', localtime($todaytime)); for ($i=1; $i<=12; $i++) { $details->{months} .= "