NAME
Calendar::Generate - Rule based calendar generation.
SYNOPSIS
This is a development release. There are gross inefficiencies, stupifyingly bad loops and structures, and some really poor design decisions. I'm working to change that. This version of Calendar::Generate is a definite departure from the older versions in several respects so if you are upgrading, expect your scripts to, at the very least, not work.
# The easy way.
use Calendar::Generate::HTML;
my $calendar = new Calendar::Generate::HTML;
$calendar->row_start( '<div id="calendar">' );
$calendar->row_end( '</div>' );
...
print $calendar->generate( 2004, 12, 25 );
# The detailed way.
# Create your own calendar subclass and override the formatting rules that
# you wish to be different.
package MyCalendar;
use base 'Calendar::Generate::HTML';
# override the rules that you want to change...
sub row_start {
return "<div id='calendar'>";
}
sub row_end {
return "</div>";
}
# and so on...
1;
# Create a script to use your fancy-pants new subclass...
...
my $calendar = new MyCalendar;
print $calendar->generate( 2004, 12, 25 );
...
DESCRIPTION
Calendar::Generate creates a formatted calendar based on rules that you provide.
Setting rules
There are essentially two approaches to editing the formatting rules. You can
subclass one of the provided formatting modules (ie. Calendar::Generate::HTML)
and override the rules that you would like changed, or you can call the methods
directly from your script which is arguably less elegant.
METHODS
- generate( year, month, day );
-
Generates the calendar. Returns a string chock full of calendar-ie goodness.
FORMATTING RULES
All formatting rules are actually L<Class::Accessor> methods.
- 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
-
Before every row in the calendar (excluding title).
- row_end
-
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_null
-
Text to insert for days that have 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 in relation to the day number. '0' for before, and '1' for 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()
AUTHOR
Clint Moore <cmoore@cpan.org>
SEE ALSO
3 POD Errors
The following errors were encountered while parsing the POD:
- Around line 236:
'=item' outside of any '=over'
- Around line 242:
You forgot a '=back' before '=head1'
You forgot a '=back' before '=head1'
- Around line 333:
You forgot a '=back' before '=head2'