#!/usr/bin/perl -w use strict; use CGI qw(:standard); use Date::Calc qw(:all); use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use HTML::AsSubs; use HTML::Element; use HTML::CalendarMonth; my $data="/path/data.txt"; my @Calendar = (); #my $checkthree = "1000"; my $checkthree = param ('check'); open (FILE,"$data") || die "whoops 1: $!"; my @all=; close (FILE); foreach my $line (@all){ my ($one,$two,$three,$four,$five,$six,$seven,$eight) = split "\t",$line; if ($three eq $checkthree) { @Calendar = split /\s+/,$seven; } } my @dates = sort @Calendar; print header(), start_html(-title => "Calendars"); while (defined $dates[0]) { my $days = $dates[0]; my ($year, $month, $day) = Add_Delta_Days(1,1,1, $days - 1); @dates = CreateCal($year, $month, @dates); } print end_html(); exit(0); sub CreateCal { my ($cyear, $cmonth, @dates) = @_; my (@days, @temp); foreach my $days (@dates) { my ($year, $month, $day) = Add_Delta_Days(1,1,1, $days - 1); if ($year == $cyear && $month == $cmonth) { push (@days, $day); } else { push (@temp, $days); } } my $c = new HTML::CalendarMonth( month => $cmonth, year => $cyear, ); $c->item($c->month)->wrap_content(font({size => '+2'})); $c->item($c->dayheaders)->wrap_content(font({size => '-1'})); $c->item(@days)->attr(bgcolor => '#CC0000'); print "

", $c->as_HTML, "

"; return @temp; }