A while back I asked a question about converting Date::Calc to HTML::CalendarMonth. The help I received enabled me to achieve a set of calendars in list form, one on top of the other.

I have decided to revisit this to try to put it into a container table, to provide a neater layout. To do this I need to produce an array of new tables to place into the container. The information for this is at Mojotoad's Calendar Test page.

Unfortunately I haven't been able to produce an array which works.
Taking a string of dates converted from Date::Calc I have:
while (defined $dates[0]) { my $days = $dates[0]; my ($year, $month, $day) = Add_Delta_Days(1,1,1, $days - 1); my $new_c = "new HTML::CalendarMonth ( year => $year, month => $month) +,"; push (@cals, $new_c); @dates = CreateCal($year, $month, @dates); }
If I print @cals it seems to reproduce the example on the Test Calendar page, but on running the rest of the example I end up with a blank screen:
# Embolden headers foreach (@cals) { $_->item($_->month,$_->year)->wrap_content(font({size => '2'})); $_->item($_->dayheaders)->wrap_content(font({size => '1'})); $_->item(15,16,17)->wrap_content(font({size => 4, color => 'red'})); } # Generate container table my $t = new HTML::ElementTable ( maxrow => 1, maxcol => 4 ); # Populate container table foreach (0..$#cals) { $t->cell(0,$_)->push_content($cals[$_]); } print $t->as_HTML; exit; 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); } } return @temp; }
could anyone tell me why my $new_c approach is failing to produce a viable array, and suggest how I should be going about this?

In reply to Generating a container table in HTML::CalendarMonth by jonnyfolk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.