line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zodiac::Tiny; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2015-11-28'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
26385
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
7
|
|
|
|
|
|
|
#use strict; |
8
|
|
|
|
|
|
|
#use warnings; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Exporter; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
415
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
13
|
|
|
|
|
|
|
zodiac_of |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub zodiac_of { |
17
|
1
|
|
|
1
|
1
|
8
|
my $date = shift; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
3
|
my ($m, $d); |
20
|
1
|
50
|
|
|
|
5
|
if (my $ref = ref($date)) { |
21
|
0
|
0
|
0
|
|
|
0
|
if ($ref eq 'DateTime' || $ref eq 'Time::Moment') { |
22
|
0
|
|
|
|
|
0
|
$m = $date->month; |
23
|
0
|
|
|
|
|
0
|
$d = $date->day_of_month; |
24
|
|
|
|
|
|
|
} else { |
25
|
0
|
|
|
|
|
0
|
die "Invalid date object, only DateTime and Time::Moment ". |
26
|
|
|
|
|
|
|
"currently supported"; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} else { |
29
|
1
|
50
|
|
|
|
14
|
($m, $d) = $date =~ /\A(?:\d\d\d\d-)?(\d\d)-(\d\d)\z/ |
30
|
|
|
|
|
|
|
or die "Invalid date string, please use YYYY-MM-DD"; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
1
|
50
|
|
|
|
22
|
if ($m == 1) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
0
|
return $d <= 19 ? "capricornus" : "aquarius"; |
35
|
|
|
|
|
|
|
} elsif ($m == 2) { |
36
|
0
|
0
|
|
|
|
0
|
return $d <= 18 ? "aquarius" : "pisces"; |
37
|
|
|
|
|
|
|
} elsif ($m == 3) { |
38
|
0
|
0
|
|
|
|
0
|
return $d <= 20 ? "pisces" : "aries"; |
39
|
|
|
|
|
|
|
} elsif ($m == 4) { |
40
|
0
|
0
|
|
|
|
0
|
return $d <= 19 ? "aries" : "taurus"; |
41
|
|
|
|
|
|
|
} elsif ($m == 5) { |
42
|
0
|
0
|
|
|
|
0
|
return $d <= 20 ? "taurus" : "gemini"; |
43
|
|
|
|
|
|
|
} elsif ($m == 6) { |
44
|
0
|
0
|
|
|
|
0
|
return $d <= 20 ? "gemini" : "cancer"; |
45
|
|
|
|
|
|
|
} elsif ($m == 7) { |
46
|
0
|
0
|
|
|
|
0
|
return $d <= 22 ? "cancer" : "leo"; |
47
|
|
|
|
|
|
|
} elsif ($m == 8) { |
48
|
0
|
0
|
|
|
|
0
|
return $d <= 22 ? "leo" : "virgo"; |
49
|
|
|
|
|
|
|
} elsif ($m == 9) { |
50
|
0
|
0
|
|
|
|
0
|
return $d <= 22 ? "virgo" : "libra"; |
51
|
|
|
|
|
|
|
} elsif ($m == 10) { |
52
|
0
|
0
|
|
|
|
0
|
return $d <= 22 ? "libra" : "scorpius"; |
53
|
|
|
|
|
|
|
} elsif ($m == 11) { |
54
|
1
|
50
|
|
|
|
10
|
return $d <= 21 ? "scorpius" : "sagittarius"; |
55
|
|
|
|
|
|
|
} else { |
56
|
0
|
0
|
|
|
|
|
return $d <= 21 ? "sagittarius" : "capricornus"; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
# ABSTRACT: Look up zodiac sign for a given date |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |