| 1 | package Zodiac::Chinese; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use base 'Exporter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | our @EXPORT_OK = qw(chinese_zodiac); | |||||||||
| 9 | 2 | our $VERSION = 1.00; | |||||||||
| 10 | |||||||||||
| 11 | 2 | my @direction = qw(yang yin); | |||||||||
| 12 | 2 | my @element = (("metal") x 2, ("water") x 2, ("wood") x 2, ("fire") x 2, ("earth") x 2); | |||||||||
| 13 | 2 | my @signs = qw(rat ox tiger rabbit dragon snake horse sheep monkey rooster dog pig); | |||||||||
| 14 | |||||||||||
| 15 | 5 | ▶ | sub chinese_zodiac { | ||||||||
|
Subroutine
chinese_zodiac: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 16 | 5 | my ($year,$month,$day) = @_; | |||||||||
| 17 | 5 | my $zodiac; | |||||||||
| 18 | 5 | ▶ | if ($month > 1) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 4 | $zodiac = $direction[$year % 2]." ".$element[$year % 10]." ".$signs[($year - 1924) % 12]; | |||||||||
| 20 | } else { | ||||||||||
| 21 | 1 | $zodiac = $direction[($year - 1) % 2]." ".$element[($year - 1) % 10]." ".$signs[(($year-1) - 1924) % 12]; | |||||||||
| 22 | } | ||||||||||
| 23 | 5 | return $zodiac; | |||||||||
| 24 | } | ||||||||||
| 25 | 2 | 1; | |||||||||
| 26 | __END__ | ||||||||||