The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

HTML::CalendarMonth::Locale - Front end class for DateTime::Locale

SYNOPSIS

  use HTML::CalendarMonth::Locale;

  my $loc = HTML::CalendarMonth::Locale->new( id => 'en_US' );

  # list of days of the week for locale
  my @days = $loc->days;

  # list of months of the year for locale
  my @months = $loc->months;

  # the name of the current locale, as supplied the id parameter to
  # new()
  my $locale_name = $loc->id;

  # the actual DateTime::Locale object
  my $loc = $loc->loc;

  1;

DESCRIPTION

HTML::CalendarMonth utilizes the powerful locale capabilities of DateTime::Locale for rendering its calendars. The default locale is 'en_US' but many others are available. To see this list, invoke the class method HTML::CalendarMonth::Locale->locales() which in turn invokes DateTime::Locale::ids().

This module is mostly intended for internal usage within HTML::CalendarMonth, but some of its functionality may be of use for developers:

METHODS

new()

Constructor. Takes the following parameters:

id

Locale id, e.g. 'en_US'.

full_days

Specifies whether full day names or their abbreviations are desired. Default 0, use abbreviated days.

full_months

Specifies whether full month names or their abbreviations are desired. Default 1, use full months.

id()

Returns the locale id used during object construction.

locale()

Accessor method for the DateTime::Locale class, which in turn offers several class methods of specific interest. See DateTime::Locale.

loc()

Accessor method for the DateTime::Locale instance as specified by id. See DateTime::Locale.

locales()

Lists all available locale ids. Equivalent to locale()->ids(), or DateTime::Locale->ids().

days()

Returns a list of days of the week, Sunday first. These are the actual days used for rendering the calendars, so depending on which attributes were provided to new(), this list will either be abbreviations or full names. The default uses abbreviated day names. Returns a list in list context or an array ref in scalar context.

narrow_days()

Returns a list of short day abbreviations, beginning with Sunday. The narrow abbreviations are not guaranteed to be unique (i.e. 'S' for both Sat and Sun).

months()

Returns a list of months of the year, beginning with January. Depending on which attributes were provided to new(), this list will either be full names or abbreviations. The default uses full names. Returns a list in list context or an array ref in scalar context.

narrow_months()

Returns a list of short month abbreviations, beginning with January. The narrow abbreviations are not guaranteed to be unique.

minmatch()

Provides a hash reference containing minimal match strings for each month of the year, e.g., 'N' for November, 'Ja' for January, 'Jul' for July, 'Jun' for June, etc.

daynums()

Provides a hash reference containing day of week numbers for each day name.

daynum($day)

Provides the day of week number for a particular day name.

monthnums()

Provides a hash reference containing month of year numbers for each month name.

monthnum($month)

Provides the month of year number for a particular month name.

minmatch_hash(@list)

This is the method used to generate the minimal match hash referenced above. Given an arbitrary list, a hash reference will be returned with minimal match strings as keys and full names as values.

first_day_of_week()

Returns a number from 1 to 7 representing the first day of the week for this locale, where 1 represents Sunday.

AUTHOR

Matthew P. Sisk, <sisk@mojotoad.com>

COPYRIGHT

Copyright (c) 2010 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

HTML::CalendarMonth(3), DateTime::Locale(3)

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 234:

'=item' outside of any '=over'

Around line 336:

You forgot a '=back' before '=head1'