line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Date::Horoscope; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2575
|
use Data::Dumper; |
|
1
|
|
|
|
|
31506
|
|
|
1
|
|
|
|
|
102
|
|
4
|
1
|
|
|
1
|
|
1628
|
use Date::Manip; |
|
1
|
|
|
|
|
312138
|
|
|
1
|
|
|
|
|
198
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
13
|
use strict qw(vars subs); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
40
|
|
8
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
649
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw(Exporter AutoLoader); |
13
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
14
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
15
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
16
|
|
|
|
|
|
|
@EXPORT = qw( |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
$VERSION = '2.2'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# year is irrelevant for our purposes |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
%Date::Horoscope::horoscope = ( |
24
|
|
|
|
|
|
|
'aries' => { |
25
|
|
|
|
|
|
|
'position' => 1, |
26
|
|
|
|
|
|
|
'start' => '3/21/92', |
27
|
|
|
|
|
|
|
'end' => '4/20/92', |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
'taurus' => { |
30
|
|
|
|
|
|
|
'position' => 2, |
31
|
|
|
|
|
|
|
'start' => '4/21/92', |
32
|
|
|
|
|
|
|
'end' => '5/20/92', |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
'gemini' => { |
35
|
|
|
|
|
|
|
'position' => 3, |
36
|
|
|
|
|
|
|
'start' => '5/21/92', |
37
|
|
|
|
|
|
|
'end' => '6/21/92', |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
'cancer' => { |
40
|
|
|
|
|
|
|
'position' => 4, |
41
|
|
|
|
|
|
|
'start' => '6/22/92', |
42
|
|
|
|
|
|
|
'end' => '7/22/92', |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
'leo' => { |
45
|
|
|
|
|
|
|
'position' => 5, |
46
|
|
|
|
|
|
|
'start' => '7/23/92', |
47
|
|
|
|
|
|
|
'end' => '8/23/92', |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
'virgo' => { |
50
|
|
|
|
|
|
|
'position' => 6, |
51
|
|
|
|
|
|
|
'start' => '8/24/92', |
52
|
|
|
|
|
|
|
'end' => '9/22/92', |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
'libra' => { |
55
|
|
|
|
|
|
|
'position' => 7, |
56
|
|
|
|
|
|
|
'start' => '9/23/92', |
57
|
|
|
|
|
|
|
'end' => '10/22/92', |
58
|
|
|
|
|
|
|
}, |
59
|
|
|
|
|
|
|
'scorpio' => { |
60
|
|
|
|
|
|
|
'position' => 8, |
61
|
|
|
|
|
|
|
'start' => '10/23/92', |
62
|
|
|
|
|
|
|
'end' => '11/21/92', |
63
|
|
|
|
|
|
|
}, |
64
|
|
|
|
|
|
|
'sagittarius' => { |
65
|
|
|
|
|
|
|
'position' => 9, |
66
|
|
|
|
|
|
|
'start' => '11/22/92', |
67
|
|
|
|
|
|
|
'end' => '12/21/92', |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
'capricorn' => { |
70
|
|
|
|
|
|
|
'position' => 10, |
71
|
|
|
|
|
|
|
'start' => '1/1/92', # NOT TRUE BUT NECESSARY |
72
|
|
|
|
|
|
|
'end' => '1/19/92', |
73
|
|
|
|
|
|
|
}, |
74
|
|
|
|
|
|
|
'aquarius' => { |
75
|
|
|
|
|
|
|
'position' => 11, |
76
|
|
|
|
|
|
|
'start' => '1/20/92', |
77
|
|
|
|
|
|
|
'end' => '2/18/92', |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
'pisces' => { |
80
|
|
|
|
|
|
|
'position' => 12, |
81
|
|
|
|
|
|
|
'start' => '2/19/92', |
82
|
|
|
|
|
|
|
'end' => '3/20/92', |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# day_month_logic: |
89
|
|
|
|
|
|
|
# ----------------------------------------------------------------------- |
90
|
|
|
|
|
|
|
# Return a one if the day/month combo is greater than the day/month combo |
91
|
|
|
|
|
|
|
# it was subtracted from. Return 0 if equal and -1 if less. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub day_month_logic { |
94
|
0
|
|
|
0
|
0
|
0
|
my ($M,$D)=@_; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#warn "day_month_logic: $M, $D"; |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
0
|
($M < 0) && return -1; |
99
|
0
|
0
|
|
|
|
0
|
($M > 0) && return 1; |
100
|
0
|
0
|
0
|
|
|
0
|
($M == 0) && ($D == 0) && return 0; |
101
|
0
|
0
|
0
|
|
|
0
|
($M == 0) && ($D > 0) && return 1; |
102
|
0
|
0
|
0
|
|
|
0
|
($M == 0) && ($D < 0) && return -1; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub locate { |
107
|
5
|
|
|
5
|
1
|
64
|
my $input_date = $_[0]; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
#warn "input_date: $input_date"; |
110
|
|
|
|
|
|
|
|
111
|
5
|
|
|
|
|
11
|
my %input_date; |
112
|
5
|
|
|
|
|
28
|
$input_date{month} = &UnixDate($input_date, '%m'); |
113
|
5
|
|
|
|
|
109942
|
$input_date{day} = &UnixDate($input_date, '%d'); |
114
|
5
|
|
|
|
|
3551
|
$input_date{year} = 1992; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#warn "Y-M-D: $input_date{year}-$input_date{month}-$input_date{day}"; |
117
|
|
|
|
|
|
|
|
118
|
5
|
0
|
33
|
|
|
37
|
return 'capricorn' if $input_date{month}==12 && $input_date{day} >=22 && $input_date{day} <=31; |
|
|
|
33
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
5
|
|
|
|
|
30
|
$input_date{new} = "$input_date{year}-$input_date{month}-$input_date{day}"; |
122
|
|
|
|
|
|
|
#warn "<1>input_date{new} = $input_date{new}"; |
123
|
5
|
|
|
|
|
20
|
$input_date{new} =~ s/\s+//g; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
#warn "<2>input_date{new} = $input_date{new}"; |
127
|
|
|
|
|
|
|
|
128
|
135
|
|
|
|
|
243
|
my @sorted_keys = |
129
|
|
|
|
|
|
|
sort { |
130
|
5
|
|
|
|
|
63
|
$Date::Horoscope::horoscope{$a}{position} |
131
|
|
|
|
|
|
|
<=> |
132
|
|
|
|
|
|
|
$Date::Horoscope::horoscope{$b}{position} |
133
|
|
|
|
|
|
|
} (keys %Date::Horoscope::horoscope); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# this returns something like 'taurus', 'sagittarius', etc. |
137
|
5
|
|
|
|
|
17
|
for my $h (@sorted_keys) { |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# start and end dates of this zodiac sign... year irrelevant |
140
|
60
|
|
|
|
|
378
|
my $start = &ParseDate($Date::Horoscope::horoscope{$h}{start}); |
141
|
60
|
|
|
|
|
72678
|
my $end = &ParseDate($Date::Horoscope::horoscope{$h}{end}); |
142
|
60
|
|
|
|
|
79743
|
my $input = &ParseDate($input_date{new}); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
60
|
|
|
|
|
49266
|
my $S=&Date_Cmp($start,$input); |
147
|
60
|
|
|
|
|
91784
|
my $E=&Date_Cmp($input,$end); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
#warn sprintf("H: %s S: %d E: %d", $h, $S, $E); |
150
|
|
|
|
|
|
|
#warn sprintf ("start: %s end: %s input: %s", $start, $end, $input); |
151
|
|
|
|
|
|
|
|
152
|
60
|
100
|
33
|
|
|
78116
|
return $h if ( |
|
|
|
100
|
|
|
|
|
|
|
|
33
|
|
|
|
|
153
|
|
|
|
|
|
|
((!$S) || (!$E)) || |
154
|
|
|
|
|
|
|
(($S < 0) && ($E < 0)) |
155
|
|
|
|
|
|
|
); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
1; |
165
|
|
|
|
|
|
|
__END__ |