HTML::Make::Calendar - Make an HTML calendar
use HTML::Make::Calendar;
This documents version 0.00_01 of HTML-Make-Calendar corresponding to git commit a297d0627ad60bfb89223f7f7f24dedddd6d7fda released on Sun Jan 10 01:07:48 2021 +0900.
This module constructs HTML calendars.
my $out = calendar (year => 2010, month => 10);
Make the calendar. The return value is an HTML::Make object. To get the actual HTML, call its text method:
text
use utf8; use FindBin '$Bin'; use HTML::Make::Calendar 'calendar'; my $out = calendar (year => 2021, month => 1); print $out->text ();
The output HTML looks like this:
(This example is included as calendar.pl in the distribution.)
The possible arguments are
Callback data, see "dayc".
Day callback. If this is omitted, a default element is added. The day callback is called with three arguments, first "cdata", second the date as a hash reference with arguments year, month and dom (day of month, a number from 1 to 31), and third the HTML element to attach the return value to, representing the cell of the calendar.
year
month
dom
&{$dayc} ($cdata, {year => 2020, month => 12, day => 21}, $td);
where $td is an HTML::Make object.
$td
The month, as a number from 1 to 12. If the month is omitted, the current month is used as given by "Today" in Date::Calc.
The year, as a four-digit number like 2020. If the year is omitted, the current year is used, as given by "Today" in Date::Calc.
2020
This example demonstrates the use of "dayc" and "cdata".
use utf8; use FindBin '$Bin'; use HTML::Make::Calendar 'calendar'; my @food = split '', '🍇🍈🍉🍊🍋🍌🍍🥭🍎🍏🍐🍑🍒🍓🥝🍅🥝🍅🥒🥬🥦🧄🧅🍄🥜🌰'; my $cal = calendar (cdata => \@food, dayc => \&add_food); print $cal->text (); exit; sub add_food { my ($food, $date, $element) = @_; my $today = $food->[int (rand (@$food))]; $element->push ('span', text => "$date->{dom} $today"); }
(This example is included as menu.pl in the distribution.)
Date::Calc supplies the date information for the calendar.
HTML::Make is used to generate the HTML for the calendar.
See html-cal in the distribution.
Includes a script cal2html for making HTML.
Fork of "HTML::Calendar::Simple". The documentation is largely copy-pasted from that with some alterations.
Ben Bullock, <bkb@cpan.org>
This package and associated files are copyright (C) 2021 Ben Bullock.
You can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence.
To install HTML::Make::Calendar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Make::Calendar
CPAN shell
perl -MCPAN -e shell install HTML::Make::Calendar
For more information on module installation, please visit the detailed CPAN module installation guide.