Date-Tolkien-Shire
    
    
  
  
  
view release on metacpan or search on metacpan
The default is C<'%Ex%n%En%Ed'>, which produces output like C<on_date()>.
=head2 -help
This option displays the documentation for this script. The script then
exits.
=head2 -shire
If this option is asserted, the arguments are dates in the Shire
calendar: either year, month, and day numbers, or year and holiday
numbers.
The default is C<-noshire>, which causes the arguments to be interpreted
as Gregorian year, month and day numbers.
=head2 -version
This option displays the version of this script. The script then exits.
=head1 DETAILS
lib/Date/Tolkien/Shire.pm view on Meta::CPAN
        year    => 1418,
        month	=> 3,
        day     => 25,
    );
    $shiredate->set_shire(
        year    => 1419,
        holiday => 3,
    );
This method sets the object's date to the given date in the Shire
calendar. The named arguments are C<year>, C<month>, C<day>, and
C<holiday>, and all are numeric. The C<year> argument is required; all
others are optional. You may not specify both C<month> and C<holiday>.
If C<month> is specified, C<day> defaults to C<1>; otherwise C<holiday>
defaults to C<1>.
This method returns the invocant. Errors are indicated by setting the
C<$ERROR> variable.
=head2 set_accented
lib/Date/Tolkien/Shire.pm view on Meta::CPAN
If L<accented()|/accented> is true, this method returns accented output.
If L<traditional()|/traditional> is true, this method uses traditional
rather than common weekday names.
=head2 strftime
This is a re-implementation imported from
L<Date::Tolkien::Shire::Data|Date::Tolkien::Shire::Data>. It is intended
to be reasonably compatible with the same-named L<DateTime|DateTime>
method, but has some additions to deal with the peculiarities of the
Shire calendar.
See L<__format()|Date::Tolkien::Shire::Data/__format> in
L<Date::Tolkien::Shire::Data|Date::Tolkien::Shire::Data> for the
documentation, since that is the code that does the heavy lifting for
us.
If L<accented()|/accented> is true, this method returns accented output.
If L<traditional()|/traditional> is true, this method uses traditional
rather than common weekday names.
lib/Date/Tolkien/Shire.pm view on Meta::CPAN
L<https://www.glyphweb.com/arda/f/fourthage.html> references a letter sent by
Tolkien in 1958 in which he estimates approximately 6000 years have passed
since the War of the Ring and the end of the Third Age.  (Thanks to Danny
O'Brien from sending me this link).  I took this approximate as an exact
and calculated back 6000 years from 1958 and set this as the start of the
4th age (1422).  Thus the fourth age begins in our B.C 4042.
According to Appendix D of the Lord of the Rings, leap years in the
hobbits'
calendar are every 4 years unless it is the turn of the century, in which
case it is not a leap year.  Our calendar uses every 4 years unless it
is
100 years unless it is 400 years.  So, if no changes had been made to
the hobbits' calendar since the end of the third age, their calendar would
be about 15 days further behind ours now then when the War of the Ring took
place.  Implementing this seemed to me to go against Tolkien's general habit
of converting dates in the novel to our equivalents to give us a better
sense of time.  My thoughts, at least right now, is that it is truer to the
spirit of things for March 25 today to be about the same as March 25 was back
then.  So instead, I have modified Tolkien's description of the hobbits'
calendar so that leap years occur once every 4 years unless it is 100
years unless it is 400 years, so that it matches our calendar in that
regard.  These 100 and 400 year intervals occur at different times in
the two calendars, however.  Thus the last day of our year is sometimes
7 Afteryule, sometimes 8, and sometimes 9.
=head1 BIBLIOGRAPHY
Tolkien, J. R. R. I<Return of the King>.  New York: Houghton Mifflin Press,
1955.
L<https://www.glyphweb.com/arda/f/fourthage.html>
=head1 BUGS
lib/Date/Tolkien/Shire.pm view on Meta::CPAN
Tom Braun <tbraun@pobox.com>
Thomas R. Wyant, III F<wyant at cpan dot org>
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2001-2003, 2006 Tom Braun. All rights reserved.
Copyright (C) 2017-2022, 2025 Thomas R. Wyant, III
The calendar implemented on this module was created by J.R.R. Tolkien,
and the copyright is still held by his estate.  The license and
copyright given herein applies only to this code and not to the
calendar itself.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself. For more details, see the full text
of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
=cut
    my $date1 = Date::Tolkien::Shire->new(
	timelocal( 0, 0, 0, 31, 11, 2037 ) );
    cmp_ok( $date1->year(), '==', 7502,
	'2037-12-31 is Shire year 7502' );
    cmp_ok( $date1->month(), 'eq', 'Afteryule',
	'2037-12-31 is month Afteryule' );
    cmp_ok( $date1->__fmt_shire_month(), '==', 1,
	'2037-12-31 is month 1 of the Shire calendar' );
    cmp_ok( $date1->day(), '==', 9, '2037-12-31 is day 9 of Afteryule' );
    cmp_ok( $date1->weekday(), 'eq', 'Monday', '2037-12-31 is Monday' );
    cmp_ok( $date1->__fmt_shire_day_of_week(), '==', 3,
	'2037-12-21 is day 3 of the Shire week' );
    cmp_ok( $date1->trad_weekday(), 'eq', 'Monendei',
	'2037-12-31 is Monendei (traditional)' );
( run in 0.364 second using v1.01-cache-2.11-cpan-5dc5da66d9d )