Another little example you've given me an excuse to haul out. Contains a stylesheet trick I like for standalone CGIs.

use strict; use CGI qw(:standard); use Date::Calc qw(:all); print header(), start_html( -title => "My Little Calendar", -head => style({ -type => 'text/css' }, join('', <DATA>),) +, ); my ($year, $month, $day) = Today(); my @month = (1 .. Days_in_Month($year, $month)); my $offset = Day_of_Week($year, $month, 1) - 1; unshift @month, map { undef } 1 .. $offset; my $end_of_month_offset = 7 - (@month % 7); push @month, (undef) x $end_of_month_offset; my @Cmonth = (); while (@month) { push @Cmonth, [ splice @month, 0, 7 ] } print table( Tr( td( { -class => 'month', -colspan => 7 }, uc(Month_to_Text($month)) ), ), Tr( map { td({ -class => 'day' }, Day_of_Week_Abbreviation($_)) } (1 .. 7) ), map { Tr( map { td({ -class => $_ == $day ? 'today' : 'date' }, $_) } @$_ ) } @Cmonth ); __DATA__ table, tr { border:0; padding:0; margin:0; } tr { text-align:center; } td { font-family:optima,helvetica,sans-serif; font-size:60%; margin:2px; padding:1px; } .day { background-color:#9ca; width: 2.2em; font-weight:bold; } .date { background-color:#9cf; height: 2em; } .today { background-color:#cef; height: 2em; } .month { text-align:center; background-color:#68b; font-size:11pt; letter-spacing:.2ex; font-weight:bold; }

In reply to Re: CGI.pm HTML-Generation Methods Considered Useful by Your Mother
in thread CGI.pm HTML-Generation Methods Considered Useful by friedo

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.