The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Date::Qreki - convert Gregorian to Japanese "kyureki" dates.

VERSION

This documents Date::Qreki version 0.07 corresponding to git commit c07982b5dc1b3e61c395505faa297f717276a4e3 released on Tue Jan 31 12:11:14 2017 +0900.

DESCRIPTION

This module contains functions related to the old Japanese lunar calendar. Convert Western dates to old Japanese lunar calendar dates with "calc_kyureki". Get the fortune-telling day with "get_rokuyou" or "rokuyou_unicode". Check if a date is a solar term with "check_24sekki".

FUNCTIONS

calc_kyureki

        @kyureki = calc_kyureki ($year, $mon, $day);

Given a western date, return the corresponding old Japanese calendar date. The return value is an array containing the following fields.

kyureki[0] - the corresponding year
kyureki[1] - if the month is a leap month (intercalary month)

See the Wikipedia article on Intercalation for an explanation.

kyureki[2] - the corresponding lunar month
kyureki[3] - the corresponding day of the lunar month

get_rokuyou

        $rokuyou = get_rokuyou ($year,$mon,$day);

Get Japanese fortune telling day. Response is from 0 to 5 corresponding to kanji names 0:大安 1:赤口 2:先勝 3:友引 4:先負 5:仏滅. See also "rokuyou_unicode" for a version which returns the kanji names of the days.

rokuyou_unicode

    my $rokuyou = rokuyou_unicode (2017, 1, 30);

This returns the kanji form of the rokuyou, which are six Japanese fortune telling days. The three arguments are year, month, and day in the modern calendar. This just calls "get_rokuyou" with the dates then returns a Unicode version of the date. See, for example, WWWJDIC for the meanings of each of these day names.

This function was added in version 0.07 of the module.

check_24sekki

    my $sekki = check_24sekki ($year, $month, $day);

Is today a Solar term? If today is a solar term, it returns the Japanese name of the solar term corresponding to the date given. The response is in character (utf8) format.

EXPORTS

Nothing is exported by default. All of the functions can be exported using the tag ":all".

    use Date::Qreki ':all';

SEE ALSO

Other CPAN modules

Date::Japanese::Era

Japanese era-based dates.

DateTime::Calendar::Japanese::Era

Older Japanese eras

DateTime::Format::Japanese
DateTime::Calendar::Japanese
Lingua::JA::FindDates

Scan text to find dates in Japanese format.

COPYRIGHT

Date::Qreki is copyright H. Takano, N. Ueno.

LICENSE

For the original licence, see "配布規定" in Date::Qreki-ja. The following is a translation of the licence.

(Translation by B. Bullock)

19 Conditions for redistribution

I would prefer to release this under the conditions of "whatever normal common sense allows", but since there are a variety of people in the world, unfortunately I think some form of framework is necessary. My wishes are as follows

i. If this script is redistributed, please also include all the original scripts, and do not modify the original script and its documentation. This also applies if the archive format (.arc, .zip, .zoo, etc.) is changed.

ii. I forbid any resale of this program beyond the cost of distribution media. (This also applies if the program is translated to a different programming language).

iii. If this is translated to a different programming language, or if part or all of this script is used as part of another program, please be sure to include the original script and this explanation with it. If part of this program is used, I retain the copyright of the quoted material only and the remaining program remains copyrighted by its author.

iv. Please do not allow the author of this software to be placed under any restrictions by your redistribution.

In any case, there is absolutely no need to obtain the author's consent or notify the author.

Original files

As required by the above licence, the original Awk script qreki.awk and its documentation qreki.doc are in the subdirectory originals in the distribution. These are text files in Shift-JIS format. To read them on a modern terminal, use something like

    iconv -f CP932 -t UTF-8  originals/qreki.doc

or

    perl -MEncode -n -e "print encode_utf8 (decode ('CP932', \$_));" < originals/qreki.doc

Web browsers also may or may not be able to render these files. Currently Google Chrome seems to be the only browser with Shift-JIS capabilities.

AUTHOR

Original Awk script by H. Takano. Perl conversion by N. Ueno. This CPAN-ification of N. Ueno's Perl script was performed by Ben Bullock.

For enquiries about this Perl module, please contact Ben Bullock <bkb@cpan.org>.