NAME
Calendar::Generate - Rule based calendar generation.
SYNOPSIS
# The easy way.
use Calendar::Generate;
my $calendar = new Calendar::Generate;
print $calendar->generate( 2004, 12, 25 );
# The detailed way.
use Calendar::Generate;
my $calendar = new Calendar::Generate;
$calendar->rules(
-month_header => "<TABLE>\n",
-title_start => '<TR><TD COLSPAN=7 ALIGN=CENTER>',
-title_end => "</TD></TR>\n",
-title_center => 1,
-title_text => undef,
-row_start => '<TR> ',
-row_end => "</TR>\n",
-space_start => '<TD> ',
-space_char => '',
-space_end => ' </TD>',
-highlight_start => '<TD> <B>',
-highlight_end => '</B> </TD>',
-digit_start => '<TD> ',
-digit_end => ' </TD>',
-dow_start => '<TH WIDTH=14%> ',
-dow_end => ' </TH>',
-dow_length => 3,
-month_footer => "</TABLE>\n",
-data_use => 0,
-data_start => '',
-data_end => '',
-data_null => '',
-data_place => 1
);
print $calendar->generate( 2004, 12, 25 );
DESCRIPTION
Calendar::Generate creates a calendar formatted based on rules that you provide.
Creating a new object
$calendar = new Calendar::Generate;
Setting rules
$calendar->rules( { param => value, ...);
FORMATTING RULES
- -month_header
-
Printed before the calendar.
- -title_start
-
The left of the month title.
- -title_end
-
The right of the month title.
- -title_center
-
Define this to center the month title.
- -row_start
-
For before every row in the calendar (excluding title).
- -row_end
-
For the end of every row in the calendar (excuding title).
- -space_start
-
Formatting start for a blank entry.
- -space_char
-
Chracter to use for a blank space.
- -space_end
-
Formatting for use at the end of a blank entry.
- -highlight_start
-
Formatting for the start of a highlighted entry.
- -highlight_end
-
... and the end of a highlighted entry.
- -digit_start
-
Formatting used before the printing of the day number.
- -digit_end
-
... and the end of the day number.
- -dow_start
-
Formatting for the start of a day of the week.
- -dow_end
-
... are you starting to see a pattern here?
- -dow_length
-
The number of letters of the day of the week to print.
-
Printed at the end of the calendar.
- -data_use
-
Determines if data associated with each date should be printed (0 = no, 1 = yes/don't print nulls, 2 = yes/print nulls)
- -data_null
-
The data to use for a day that has no associated data.
- -data_start
-
Formatting for the start of a data item.
- -data_end
-
... and the end.
- -data_place
-
determines where data item should be placed (0 = before, 1 = after)
Printing output
Both of these return the formatted calendar.
$calendar->generate( 'Year', 'Month', 'Day' );
$calendar->calendar();
Generate actually builds the calendar so if you plan to use get_calendar() for whatever reason, you need to have first called generate()
PROVIDED RULESETS
$calendar->rules_cal();
This is a set of attributes which will make the output look like that of cal(1). It is also currently the default set of attributes.
$calendar->rules_html();
This is a set of attributes which will make the output print well in a table compliant web browser. It also works in the Lynx text browser.
AUTHOR
This module is based on code origionally written by Matthew Darwin and the origional version is available at http://www.mdarwin.ca/perl
Currently the maintainer is Clint Moore <cmoore@cpan.org>
SEE ALSO
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 479:
You forgot a '=back' before '=head2'
- Around line 499:
=back without =over