| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IChing::Hexagram::Illuminatus; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$IChing::Hexagram::Illuminatus::VERSION = "0.01"; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
27858
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
7
|
1
|
|
|
1
|
|
1126
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
52777
|
|
|
|
1
|
|
|
|
|
40
|
|
|
8
|
1
|
|
|
1
|
|
11
|
use HTTP::Request; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
9
|
1
|
|
|
1
|
|
858
|
use HTML::Summary; |
|
|
1
|
|
|
|
|
41558
|
|
|
|
1
|
|
|
|
|
32
|
|
|
10
|
1
|
|
|
1
|
|
1372
|
use HTML::TreeBuilder; |
|
|
1
|
|
|
|
|
37393
|
|
|
|
1
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
IChing::Hexagram::Illuminatus - An IChing hexagram |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use IChing::Hexagram::Illuminatus; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $hex = IChing::Hexagram::Illuminatus->new; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $hex = IChing::Hexagram::Illuminatus->new( |
|
23
|
|
|
|
|
|
|
{ political => 'http://policital.site.com', |
|
24
|
|
|
|
|
|
|
economic => 'http://economic.ste.com', |
|
25
|
|
|
|
|
|
|
meterological => 'http://meterological.ste.com', |
|
26
|
|
|
|
|
|
|
astrological => 'http://astrological.ste.com', |
|
27
|
|
|
|
|
|
|
astronomical => 'http://astronomical.ste.com', |
|
28
|
|
|
|
|
|
|
technological => 'http://technoloigical.ste.com', |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $political_reference = $hex->political; |
|
33
|
|
|
|
|
|
|
my $economic_reference = $hex->economic; |
|
34
|
|
|
|
|
|
|
my $meterological_reference = $hex->meterological; |
|
35
|
|
|
|
|
|
|
my $astrological_reference = $hex->astrological; |
|
36
|
|
|
|
|
|
|
my $astronomical_reference = $hex->astronomical; |
|
37
|
|
|
|
|
|
|
my $technological_reference = $hex->technological; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $reading = $hex->throw; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
While reading the Illuminatus! Trilogy, there is a machine called FUCKUP, which |
|
44
|
|
|
|
|
|
|
stands for First Universal Cybernetic-Kinetic-Ultramicro-Programmer. And |
|
45
|
|
|
|
|
|
|
Hagbard Celine uses this to generate an IChing hexagram. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This modules attempts to do the same thing. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 So what is an IChing hexagram then? |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Honestly? I have no idea. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 Alright then, how is it described in the book? |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Glad you asked. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This will read a random open circuit as a broken (yin) line, then read a |
|
58
|
|
|
|
|
|
|
random closed circuit as a full (yang) line, until six such lines are |
|
59
|
|
|
|
|
|
|
round, then simulate an IChing hexagram being thrown. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This is fed into the IChing interpretation engine, and cross checked with |
|
62
|
|
|
|
|
|
|
the current day's political, economic, meterological, astrological, |
|
63
|
|
|
|
|
|
|
astronomical and technological news. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
At the end of all this, you have a pseudo scientific/crackpot prediciton of |
|
66
|
|
|
|
|
|
|
the future. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 So I get my fortune told. Is that it? |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Not only your fortune, but a broad sweep of What Is To Come. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
OK, I admit it. What a pile of old trousers. But I like the books, and |
|
73
|
|
|
|
|
|
|
this is part of my homage to them. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 METHODS |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 new |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $hex = IChing::Hexagram::Illuminatus->new; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $hex = IChing::Hexagram::Illuminatus->new( |
|
82
|
|
|
|
|
|
|
{ political => 'http://policital.site.com', |
|
83
|
|
|
|
|
|
|
economic => 'http://economic.ste.com', |
|
84
|
|
|
|
|
|
|
meterological => 'http://meterological.ste.com', |
|
85
|
|
|
|
|
|
|
astrological => 'http://astrological.ste.com', |
|
86
|
|
|
|
|
|
|
astronomical => 'http://astronomical.ste.com', |
|
87
|
|
|
|
|
|
|
technological => 'http://technoloigical.ste.com', |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This will make a new IChing::Hexagram::Illuminatus object. All the values |
|
92
|
|
|
|
|
|
|
passed in with the hashref are optional. If nothing is passed in, defaults |
|
93
|
|
|
|
|
|
|
are used as defined by me. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub new { |
|
98
|
2
|
|
|
2
|
1
|
16
|
my $self = {}; |
|
99
|
2
|
|
|
|
|
6
|
bless $self, shift; |
|
100
|
2
|
|
|
|
|
10
|
return $self->_init(@_); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _init { |
|
104
|
2
|
|
|
2
|
|
4
|
my ($self, $ref) = @_; |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# |
|
107
|
|
|
|
|
|
|
# yes, I know I could contruct this differently. |
|
108
|
|
|
|
|
|
|
# |
|
109
|
2
|
|
50
|
|
|
24
|
$self->{political} = $ref->{political} || 'http://www.stopworldwar3.com/News.rdf'; |
|
110
|
2
|
|
50
|
|
|
14
|
$self->{economic} = $ref->{economic} || 'http://headlines.internet.com/internetnews/bus-news/news.rss'; |
|
111
|
2
|
|
50
|
|
|
12
|
$self->{meterological} = $ref->{meterological} || 'http://weather.yahoo.com'; |
|
112
|
2
|
|
50
|
|
|
12
|
$self->{astrological} = $ref->{astrological} || 'http://slashgoth.org/backend/weblog.rdf'; |
|
113
|
2
|
|
50
|
|
|
12
|
$self->{astronomical} = $ref->{astronomical} || 'http://www.beyond2000.com/b2k.rdf'; |
|
114
|
2
|
|
100
|
|
|
11
|
$self->{technological} = $ref->{technological} || 'http://www.slashdot.org/slashdot.rdf'; |
|
115
|
|
|
|
|
|
|
|
|
116
|
2
|
|
|
|
|
7
|
return $self; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 throw |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $reading = $hex->throw; |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This will get you the hexagram. It is a string, on three lines, with |
|
124
|
|
|
|
|
|
|
a digit on each line, either a one or a zero. The one represents |
|
125
|
|
|
|
|
|
|
an unbroken yin line, while a zero gives the broken yang line. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
For example, |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
0 -- -- |
|
130
|
|
|
|
|
|
|
1 would be read as _____ |
|
131
|
|
|
|
|
|
|
1 _____ |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
But as well as the hexagram, it gets you the news from various sources. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
From these two things, if you are skilled, and Know The Way, then you |
|
136
|
|
|
|
|
|
|
can interpret these and discover what is going on in the world. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub throw { |
|
141
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
142
|
1
|
|
|
|
|
4
|
my $hex = $self->_hexagram; |
|
143
|
1
|
|
|
|
|
4
|
my $text = $self->_get_headlines; |
|
144
|
1
|
|
|
|
|
103
|
print "Your hexagram: $hex\n\nWorld info\n$text\n\n"; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub _hexagram { |
|
148
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
149
|
|
|
|
|
|
|
# |
|
150
|
|
|
|
|
|
|
# TODO : Make this a better random number |
|
151
|
|
|
|
|
|
|
# |
|
152
|
|
|
|
|
|
|
|
|
153
|
1
|
|
|
3
|
|
5
|
my $bin = sub { int rand(2) }; |
|
|
3
|
|
|
|
|
55
|
|
|
154
|
1
|
|
|
|
|
2
|
my $pattern; |
|
155
|
1
|
|
|
|
|
5
|
$pattern .= $bin->() for (1 .. 3); |
|
156
|
1
|
|
|
|
|
5
|
return $pattern; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub _ua { |
|
160
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
161
|
1
|
50
|
|
|
|
4
|
unless (exists $self->{ua}) { |
|
162
|
1
|
|
|
|
|
13
|
$self->{ua} = LWP::UserAgent->new; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
1
|
|
|
|
|
4489
|
return $self->{ua}; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub _summary { |
|
168
|
1
|
|
|
1
|
|
1
|
my $self = shift; |
|
169
|
1
|
50
|
|
|
|
8
|
unless (exists $self->{summary}) { |
|
170
|
1
|
|
|
|
|
12
|
$self->{summary} = HTML::Summary->new( |
|
171
|
|
|
|
|
|
|
LENGTH => 500, |
|
172
|
|
|
|
|
|
|
USE_META => 1, |
|
173
|
|
|
|
|
|
|
); |
|
174
|
|
|
|
|
|
|
} |
|
175
|
1
|
|
|
|
|
30
|
return $self->{summary}; |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub _get_headlines { |
|
179
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
180
|
1
|
|
|
|
|
4
|
my $ua = $self->_ua; my $summarizer = $self->_summary; |
|
|
1
|
|
|
|
|
5
|
|
|
181
|
1
|
|
|
|
|
2
|
my $rubbish; |
|
182
|
1
|
|
|
|
|
3
|
foreach my $category (qw/political economic meterological |
|
183
|
|
|
|
|
|
|
astrological astronomical technological/) { |
|
184
|
6
|
|
|
|
|
43
|
my $response = $ua->request(HTTP::Request->new('GET', $self->$category)); |
|
185
|
6
|
|
|
|
|
4962447
|
my $tree = HTML::TreeBuilder->new; |
|
186
|
6
|
|
|
|
|
2181
|
$tree->parse( $response->as_string ); |
|
187
|
6
|
|
|
|
|
379859
|
my ($summary, $throw) = split /HTTP/, $summarizer->generate( $tree ); |
|
188
|
6
|
|
|
|
|
107463
|
$rubbish .= "\n$category\n$summary\n" |
|
189
|
|
|
|
|
|
|
} |
|
190
|
1
|
|
|
|
|
6
|
return $rubbish; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 political |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
my $political_reference = $hex->political; |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This will return the site from which the political information if gathered. |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=cut |
|
200
|
|
|
|
|
|
|
|
|
201
|
1
|
|
|
1
|
1
|
10
|
sub political { shift->{political} } |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head2 meterological |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
my $meterological_reference = $hex->meterological; |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
This will return the site from which the meterological information if gathered. |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |
|
210
|
|
|
|
|
|
|
|
|
211
|
1
|
|
|
1
|
1
|
13
|
sub meterological { shift->{meterological} } |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 economic |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my $economic_reference = $hex->economic; |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
This will return the site from which the economic information if gathered. |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |
|
220
|
|
|
|
|
|
|
|
|
221
|
1
|
|
|
1
|
1
|
12
|
sub economic { shift->{economic} } |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 astrological |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
my $mastrological_reference = $hex->astrological; |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
This will return the site from which the astrological information if gathered. |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=cut |
|
230
|
|
|
|
|
|
|
|
|
231
|
1
|
|
|
1
|
1
|
10
|
sub astrological { shift->{astrological} } |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 astronomical |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
my $mastronomical_reference = $hex->astronomical; |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
This will return the site from which the astronomical information if gathered. |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=cut |
|
240
|
|
|
|
|
|
|
|
|
241
|
1
|
|
|
1
|
1
|
11
|
sub astronomical { shift->{astronomical} } |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 technologcal |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
my $technological_reference = $hex->technological; |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
This will return the site from which the technological information if gathered. |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=cut |
|
250
|
|
|
|
|
|
|
|
|
251
|
3
|
|
|
3
|
0
|
86
|
sub technological { shift->{technological} } |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head1 TODO |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
o Perhaps include some interpretation engine? Which takes the hexagram and |
|
256
|
|
|
|
|
|
|
the headlines and predicts the future? |
|
257
|
|
|
|
|
|
|
o Stop thinking about this module |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head1 SHOWING YOUR APPRECIATION |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
There was a thread on london.pm mailing list about working in a vacumn |
|
262
|
|
|
|
|
|
|
- that it was a bit depressing to keep writing modules but never get |
|
263
|
|
|
|
|
|
|
any feedback. So, if you use and like this module then please send me |
|
264
|
|
|
|
|
|
|
an email and make my day. |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
All it takes is a few little bytes. |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
(Leon wrote that, not me!) |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head1 AUTHOR |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Stray Toaster EFE |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head2 With Thanks |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
o Robert Shea and Robert Anton Wilson for giving me both the Illuminatus! |
|
277
|
|
|
|
|
|
|
and the Schrodinger Cat books! |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
Copyright (C) 2002, mwk |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
This module is free software; you can redistribute it or modify it |
|
284
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head1 SANITY CLAUSE |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
Ain't you heard? There is no Sanity Clause. Surely that is obvious?! |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head1 So why doesn't this live in the ACME:: namespace? |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
A good, and very valid, question. |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Perhaps I have taken this all a bit lightly, but I am sure that there are |
|
295
|
|
|
|
|
|
|
those who think their lives should be lived by what the IChing readings tell |
|
296
|
|
|
|
|
|
|
them. And far be it for me to make a mockery of their beliefs, as I am sure |
|
297
|
|
|
|
|
|
|
some of mine are just as wacky in their eyes. |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
So, in the interest of community relations, I have decided to pollute the top |
|
300
|
|
|
|
|
|
|
level namespace. As, indeed, someone might want to (upon being inspired and |
|
301
|
|
|
|
|
|
|
spurred by this module) create an IChing::Hexagram::Real or something. |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=cut |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
return qw/No secret message in this one. Sorry!/; |