in reply to Generating a container table in HTML::CalendarMonth

Hrrmm...
I've got myself stuck on how to get @days into each table. I've re-ordered my approach and would imagine that combining @dates with $new_c in a hash would be the way to go but I'm not sure how to do it.

the framework I am considering is shown below - if anyone can give me some pointers I'd be very grateful.

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); } exit(0); sub CreateCal { my ($cyear, $cmonth, @dates) = @_; my (@days, @temp); my $days; 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); } } if (@temp) { my $new_c = new HTML::CalendarMonth(month => $cmonth, year => $c +year,); push (@cals, $new_c); return @temp; } else { # Embolden headers foreach (@cals) { $_->item($_->month,$_->year)->wrap_content(font({size => '2'})) +; $_->item($_->dayheaders)->wrap_content(font({size => '1'})); $_->item(@days)->wrap_content(font({size => 4, color => 'red'})); #print "this is getting through"; # Generate container table my $t = new HTML::ElementTable ( maxrow => 1, maxcol => 6 ); # Populate container table foreach (0..$#cals) { $t->cell(0,$_)->push_content($cals[$_]); } print $t->as_HTML; exit; } } }

Replies are listed 'Best First'.
Re: Re: Generating a container table in HTML::CalendarMonth
by Mr. Muskrat (Canon) on Mar 25, 2003 at 15:26 UTC

    At first glance I see that here:

    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); }
    you are calling Add_Delta_Days. Then you call it again in the CreateCal subroutine with different data.

    Is it supposed to do that? Maybe I'm not understanding what you hope to acheive.