File Coverage

blib/lib/Bible/Reference.pm
Criterion Covered Total %
statement 409 409 100.0
branch 144 164 87.8
condition 76 101 75.2
subroutine 26 26 100.0
pod 17 17 100.0
total 672 717 93.7


line stmt bran cond sub pod time code
1             package Bible::Reference;
2             # ABSTRACT: Simple Bible reference parser, tester, and canonicalizer
3              
4 1     1   225527 use 5.020;
  1         8  
5              
6 1     1   458 use exact;
  1         35679  
  1         4  
7 1     1   2949 use exact::class;
  1         11326  
  1         4  
8              
9             our $VERSION = '1.13'; # VERSION
10              
11             has acronyms => 0;
12             has sorting => 1;
13             has require_verse_match => 0;
14             has require_book_ucfirst => 0;
15             has minimum_book_length => 3;
16             has add_detail => 0;
17              
18             has _bibles => {
19             Protestant => [
20             [ 'Genesis', 'Ge', 'Gn', 'Gen' ],
21             [ 'Exodus', 'Ex', 'Exo' ],
22             [ 'Leviticus', 'Lv', 'Lev' ],
23             [ 'Numbers', 'Nu', 'Nm', 'Num' ],
24             [ 'Deuteronomy', 'Dt', 'Deu' ],
25             [ 'Joshua', 'Jsh', 'Jos', 'Josh' ],
26             [ 'Judges', 'Jdg', 'Judg' ],
27             [ 'Ruth', 'Ru', 'Rut' ],
28             [ '1 Samuel', '1Sa', '1Sm', '1Sam' ],
29             [ '2 Samuel', '2Sa', '2Sm', '2Sam' ],
30             [ '1 Kings', '1Ki', '1Kg', '1Kgs', '1Kin' ],
31             [ '2 Kings', '2Ki', '2Kg', '2Kgs', '2Kin' ],
32             [ '1 Chronicles', '1Ch', '1Cr', '1Chr' ],
33             [ '2 Chronicles', '2Ch', '2Cr', '2Chr' ],
34             [ 'Ezra', 'Ezr' ],
35             [ 'Nehemiah', 'Ne', 'Neh' ],
36             [ 'Esther', 'Est', 'Esth' ],
37             [ 'Job', 'Jb', 'Jo', 'Job' ],
38             [ 'Psalm', 'Ps', 'Psa', 'Psalms' ],
39             [ 'Proverbs', 'Pr', 'Prv', 'Pro', 'Prov' ],
40             [ 'Ecclesiastes', 'Ec', 'Ecc', 'Eccl' ],
41             [ 'Song of Solomon', 'SS', 'Son', 'Song', 'Song of Songs' ],
42             [ 'Isaiah', 'Is', 'Isa' ],
43             [ 'Jeremiah', 'Jr', 'Jer' ],
44             [ 'Lamentations', 'Lm', 'La', 'Lam' ],
45             [ 'Ezekiel', 'Ezk', 'Ez', 'Eze', 'Ezek' ],
46             [ 'Daniel', 'Da', 'Dn', 'Dan' ],
47             [ 'Hosea', 'Ho', 'Hs', 'Hos' ],
48             [ 'Joel', 'Jl', 'Joe', 'Joel' ],
49             [ 'Amos', 'Am', 'Amo' ],
50             [ 'Obadiah', 'Ob', 'Oba' ],
51             [ 'Jonah', 'Jnh', 'Jon', 'Jona' ],
52             [ 'Micah', 'Mi', 'Mic' ],
53             [ 'Nahum', 'Na', 'Nah' ],
54             [ 'Habakkuk', 'Hab' ],
55             [ 'Zephaniah', 'Zp', 'Zep', 'Zph', 'Zeph' ],
56             [ 'Haggai', 'Hg', 'Hag' ],
57             [ 'Zechariah', 'Zec', 'Zch', 'Zech' ],
58             [ 'Malachi', 'Ml', 'Mal' ],
59             [ 'Matthew', 'Mt', 'Mat', 'Matt' ],
60             [ 'Mark', 'Mk', 'Mr', 'Mc', 'Mark' ],
61             [ 'Luke', 'Lk', 'Lu', 'Luk' ],
62             [ 'John', 'Joh' ],
63             [ 'Acts', 'Ac', 'Act' ],
64             [ 'Romans', 'Ro', 'Rm', 'Rom', 'Roms' ],
65             [ '1 Corinthians', '1Co', '1Cor' ],
66             [ '2 Corinthians', '2Co', '2Cor' ],
67             [ 'Galatians', 'Ga', 'Gl', 'Gal' ],
68             [ 'Ephesians', 'Ep', 'Eph' ],
69             [ 'Philippians', 'Php', 'Phil' ],
70             [ 'Colossians', 'Cl', 'Col' ],
71             [ '1 Thessalonians', '1Th', '1The' ],
72             [ '2 Thessalonians', '2Th', '2The' ],
73             [ '1 Timothy', '1Ti', '1Tm', '1Tim' ],
74             [ '2 Timothy', '2Ti', '2Tm', '2Tim' ],
75             [ 'Titus', 'Ti', 'Tt' ],
76             [ 'Philemon', 'Phm', 'Phlm', 'Phile' ],
77             [ 'Hebrews', 'He', 'Heb' ],
78             [ 'James', 'Jam', 'Jms', 'Jas' ],
79             [ '1 Peter', '1Pt', '1Pe', '1Pet' ],
80             [ '2 Peter', '2Pt', '2Pe', '2Pet' ],
81             [ '1 John', '1Jn', '1Jo', '1Joh' ],
82             [ '2 John', '2Jn', '2Jo', '2Joh' ],
83             [ '3 John', '3Jn', '3Jo', '3Joh' ],
84             [ 'Jude', 'Jud', 'Jude' ],
85             [ 'Revelation', 'Rv', 'Rev' ],
86             ],
87             Catholic => [
88             [ 'Genesis', 'Ge', 'Gn', 'Gen' ],
89             [ 'Exodus', 'Ex', 'Exo' ],
90             [ 'Leviticus', 'Lv', 'Lev' ],
91             [ 'Numbers', 'Nu', 'Nm', 'Num' ],
92             [ 'Deuteronomy', 'Dt', 'Deu' ],
93             [ 'Joshua', 'Jsh', 'Jos', 'Josh' ],
94             [ 'Judges', 'Jdg', 'Judg' ],
95             [ 'Ruth', 'Ru', 'Rut' ],
96             [ '1 Samuel', '1Sa', '1Sm', '1Sam' ],
97             [ '2 Samuel', '2Sa', '2Sm', '2Sam' ],
98             [ '1 Kings', '1Ki', '1Kg', '1Kgs', '1Kin' ],
99             [ '2 Kings', '2Ki', '2Kg', '2Kgs', '2Kin' ],
100             [ '1 Chronicles', '1Ch', '1Cr', '1Chr' ],
101             [ '2 Chronicles', '2Ch', '2Cr', '2Chr' ],
102             [ 'Ezra', 'Ezr' ],
103             [ 'Nehemiah', 'Ne', 'Neh' ],
104             [ 'Tobit', 'Tb', 'Tob' ],
105             [ 'Judith', 'Judi' ],
106             [ 'Esther', 'Est', 'Esth' ],
107             [ '1 Maccabees', '1Ma', '1Mac' ],
108             [ '2 Maccabees', '2Ma', '2Mac' ],
109             [ 'Job', 'Jb', 'Jo', 'Job' ],
110             [ 'Psalm', 'Ps', 'Psa', 'Psalms' ],
111             [ 'Proverbs', 'Pr', 'Prv', 'Pro', 'Prov' ],
112             [ 'Ecclesiastes', 'Ec', 'Ecc', 'Eccl' ],
113             [ 'Song of Solomon', 'SS', 'Son', 'Song', 'Song of Songs' ],
114             [ 'Wisdom', 'Wi', 'Ws', 'Wis' ],
115             [ 'Sirach', 'Si', 'Sr', 'Sir' ],
116             [ 'Isaiah', 'Is', 'Isa' ],
117             [ 'Jeremiah', 'Jr', 'Jer' ],
118             [ 'Lamentations', 'Lm', 'La', 'Lam' ],
119             [ 'Baruch', 'Ba', 'Br', 'Bar' ],
120             [ 'Ezekiel', 'Ezk', 'Ez', 'Eze', 'Ezek' ],
121             [ 'Daniel', 'Da', 'Dn', 'Dan' ],
122             [ 'Hosea', 'Ho', 'Hs', 'Hos' ],
123             [ 'Joel', 'Jl', 'Joe', 'Joel' ],
124             [ 'Amos', 'Am', 'Amo' ],
125             [ 'Obadiah', 'Ob', 'Oba' ],
126             [ 'Jonah', 'Jnh', 'Jon', 'Jona' ],
127             [ 'Micah', 'Mi', 'Mic' ],
128             [ 'Nahum', 'Na', 'Nah' ],
129             [ 'Habakkuk', 'Hab' ],
130             [ 'Zephaniah', 'Zp', 'Zep', 'Zph', 'Zeph' ],
131             [ 'Haggai', 'Hg', 'Hag' ],
132             [ 'Zechariah', 'Zec', 'Zch', 'Zech' ],
133             [ 'Malachi', 'Ml', 'Mal' ],
134             [ 'Matthew', 'Mt', 'Mat', 'Matt' ],
135             [ 'Mark', 'Mk', 'Mr', 'Mc', 'Mark' ],
136             [ 'Luke', 'Lk', 'Lu', 'Luk' ],
137             [ 'John', 'Joh' ],
138             [ 'Acts', 'Ac', 'Act' ],
139             [ 'Romans', 'Ro', 'Rm', 'Rom', 'Roms' ],
140             [ '1 Corinthians', '1Co', '1Cor' ],
141             [ '2 Corinthians', '2Co', '2Cor' ],
142             [ 'Galatians', 'Ga', 'Gl', 'Gal' ],
143             [ 'Ephesians', 'Ep', 'Eph' ],
144             [ 'Philippians', 'Php', 'Phil' ],
145             [ 'Colossians', 'Cl', 'Col' ],
146             [ '1 Thessalonians', '1Th', '1The' ],
147             [ '2 Thessalonians', '2Th', '2The' ],
148             [ '1 Timothy', '1Ti', '1Tm', '1Tim' ],
149             [ '2 Timothy', '2Ti', '2Tm', '2Tim' ],
150             [ 'Titus', 'Ti', 'Tt' ],
151             [ 'Philemon', 'Phm', 'Phlm', 'Phile' ],
152             [ 'Hebrews', 'He', 'Heb' ],
153             [ 'James', 'Jam', 'Jms', 'Jas' ],
154             [ '1 Peter', '1Pt', '1Pe', '1Pet' ],
155             [ '2 Peter', '2Pt', '2Pe', '2Pet' ],
156             [ '1 John', '1Jn', '1Jo', '1Joh' ],
157             [ '2 John', '2Jn', '2Jo', '2Joh' ],
158             [ '3 John', '3Jn', '3Jo', '3Joh' ],
159             [ 'Jude', 'Jud', 'Jude' ],
160             [ 'Revelation', 'Rv', 'Rev' ],
161             ],
162             Orthodox => [
163             [ 'Genesis', 'Ge', 'Gn', 'Gen' ],
164             [ 'Exodus', 'Ex', 'Exo', 'Exod' ],
165             [ 'Leviticus', 'Lv', 'Lev' ],
166             [ 'Numbers', 'Nu', 'Nm', 'Num' ],
167             [ 'Deuteronomy', 'Dt', 'Deu', 'Deut' ],
168             [ 'Joshua', 'Jsh', 'Jos', 'Josh' ],
169             [ 'Judges', 'Jdg', 'Judg' ],
170             [ 'Ruth', 'Ru', 'Rut' ],
171             [ '1 Samuel', '1Sa', '1Sm', '1Sam' ],
172             [ '2 Samuel', '2Sa', '2Sm', '2Sam' ],
173             [ '1 Kings', '1Ki', '1Kg', '1Kgs', '1Kin' ],
174             [ '2 Kings', '2Ki', '2Kg', '2Kgs', '2Kin' ],
175             [ '1 Chronicles', '1Ch', '1Cr', '1Chr' ],
176             [ '2 Chronicles', '2Ch', '2Cr', '2Chr' ],
177             [ '1 Esdras', '1Esd' ],
178             [ '2 Esdras', '2Esd' ],
179             [ 'Ezra', 'Ezr' ],
180             [ 'Nehemiah', 'Ne', 'Neh' ],
181             [ 'Tobit', 'Tb', 'Tob' ],
182             [ 'Judith', 'Judi', 'Jdt' ],
183             [ 'Esther', 'Est', 'Esth' ],
184             [ 'Greek Esther', 'GkEsth' ],
185             [ '1 Maccabees', '1Ma', '1Mac', '1Macc' ],
186             [ '2 Maccabees', '2Ma', '2Mac', '2Macc' ],
187             [ '3 Maccabees', '3Ma', '3Mac', '3Macc' ],
188             [ '4 Maccabees', '4Ma', '4Mac', '4Macc' ],
189             [ 'Job', 'Jb', 'Jo', 'Job' ],
190             [ 'Prayer of Manasseh', 'PM', 'Pra', 'Man', 'PrMan' ],
191             [ 'Psalm', 'Ps', 'Psa', 'Psalms' ],
192             [ 'Proverbs', 'Pr', 'Prv', 'Pro', 'Prov' ],
193             [ 'Ecclesiastes', 'Ec', 'Ecc', 'Eccl' ],
194             [ 'Song of Solomon', 'SS', 'Son', 'Song', 'Song of Songs' ],
195             [ 'Wisdom', 'Wi', 'Ws', 'Wis' ],
196             [ 'Sirach', 'Si', 'Sr', 'Sir' ],
197             [ 'Isaiah', 'Is', 'Isa' ],
198             [ 'Jeremiah', 'Jr', 'Jer' ],
199             [ 'Lamentations', 'Lm', 'La', 'Lam' ],
200             [ 'Baruch', 'Ba', 'Br', 'Bar' ],
201             [ 'Letter of Jeremiah', 'LJ', 'Let', 'EpJer' ],
202             [ 'Susanna', 'Sus' ],
203             [ 'Bel and the Dragon', 'Bel' ],
204             [ 'Three Young Men Song', 'SgThr', 'Three' ],
205             [ 'Ezekiel', 'Ezk', 'Ez', 'Eze', 'Ezek' ],
206             [ 'Daniel', 'Da', 'Dn', 'Dan' ],
207             [ 'Hosea', 'Ho', 'Hs', 'Hos' ],
208             [ 'Joel', 'Jl', 'Joe', 'Joel' ],
209             [ 'Amos', 'Am', 'Amo' ],
210             [ 'Obadiah', 'Ob', 'Oba', 'Obad' ],
211             [ 'Jonah', 'Jnh', 'Jon', 'Jona' ],
212             [ 'Micah', 'Mi', 'Mic' ],
213             [ 'Nahum', 'Na', 'Nah' ],
214             [ 'Habakkuk', 'Hab' ],
215             [ 'Zephaniah', 'Zp', 'Zep', 'Zph', 'Zeph' ],
216             [ 'Haggai', 'Hg', 'Hag' ],
217             [ 'Zechariah', 'Zec', 'Zch', 'Zech' ],
218             [ 'Malachi', 'Ml', 'Mal' ],
219             [ 'Matthew', 'Mt', 'Mat', 'Matt' ],
220             [ 'Mark', 'Mk', 'Mr', 'Mc', 'Mark' ],
221             [ 'Luke', 'Lk', 'Lu', 'Luk' ],
222             [ 'John', 'Joh' ],
223             [ 'Acts', 'Ac', 'Act' ],
224             [ 'Romans', 'Ro', 'Rm', 'Rom', 'Roms' ],
225             [ '1 Corinthians', '1Co', '1Cor' ],
226             [ '2 Corinthians', '2Co', '2Cor' ],
227             [ 'Galatians', 'Ga', 'Gl', 'Gal' ],
228             [ 'Ephesians', 'Ep', 'Eph' ],
229             [ 'Philippians', 'Php', 'Phil' ],
230             [ 'Colossians', 'Cl', 'Col' ],
231             [ '1 Thessalonians', '1Th', '1The', '1Thess' ],
232             [ '2 Thessalonians', '2Th', '2The', '2Thess' ],
233             [ '1 Timothy', '1Ti', '1Tm', '1Tim' ],
234             [ '2 Timothy', '2Ti', '2Tm', '2Tim' ],
235             [ 'Titus', 'Ti', 'Tt' ],
236             [ 'Philemon', 'Phm', 'Phlm', 'Phile' ],
237             [ 'Hebrews', 'He', 'Heb' ],
238             [ 'James', 'Jam', 'Jms', 'Jas' ],
239             [ '1 Peter', '1Pt', '1Pe', '1Pet' ],
240             [ '2 Peter', '2Pt', '2Pe', '2Pet' ],
241             [ '1 John', '1Jn', '1Jo', '1Joh', '1John' ],
242             [ '2 John', '2Jn', '2Jo', '2Joh', '2John' ],
243             [ '3 John', '3Jn', '3Jo', '3Joh', '3John' ],
244             [ 'Jude', 'Jud', 'Jude' ],
245             [ 'Revelation', 'Rv', 'Rev' ],
246             ],
247             };
248              
249             has _lengths => {
250             Protestant => [
251             [
252             31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67,
253             34, 35, 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22,
254             33, 26
255             ],
256             [
257             22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18, 40,
258             37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38
259             ],
260             [
261             17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55,
262             46, 34
263             ],
264             [
265             54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22, 29, 35, 41, 30, 25,
266             18, 65, 23, 31, 40, 16, 54, 42, 56, 29, 34, 13
267             ],
268             [
269             46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 32, 18, 29, 23, 22, 20, 22, 21, 20, 23, 30, 25, 22,
270             19, 19, 26, 68, 29, 20, 30, 52, 29, 12
271             ],
272             [ 18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33 ],
273             [ 36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25 ],
274             [ 22, 23, 18, 22 ],
275             [
276             28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 42, 15, 23, 29, 22, 44,
277             25, 12, 25, 11, 31, 13
278             ],
279             [ 27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 33, 43, 26, 22, 51, 39, 25 ],
280             [ 53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 53 ],
281             [ 18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30 ],
282             [
283             54, 55, 24, 43, 26, 81, 40, 40, 44, 14, 47, 40, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31,
284             32, 34, 21, 30
285             ],
286             [
287             17, 18, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 22, 15, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27,
288             28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23
289             ],
290             [ 11, 70, 13, 24, 17, 22, 28, 36, 15, 44 ],
291             [ 11, 20, 32, 23, 19, 19, 73, 18, 38, 39, 36, 47, 31 ],
292             [ 22, 23, 15, 17, 14, 14, 10, 17, 32, 3 ],
293             [
294             22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29, 29, 34, 30, 17, 25, 6,
295             14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 30, 24, 34, 17
296             ],
297             [
298             6, 12, 8, 8, 12, 10, 17, 9, 20, 18, 7, 8, 6, 7, 5, 11, 15, 50, 14, 9, 13, 31, 6, 10, 22, 12, 14,
299             9, 11, 12, 24, 11, 22, 22, 28, 12, 40, 22, 13, 17, 13, 11, 5, 26, 17, 11, 9, 14, 20, 23, 19, 9, 6,
300             7, 23, 13, 11, 11, 17, 12, 8, 12, 11, 10, 13, 20, 7, 35, 36, 5, 24, 20, 28, 23, 10, 12, 20, 72,
301             13, 19, 16, 8, 18, 12, 13, 17, 7, 18, 52, 17, 16, 15, 5, 23, 11, 13, 12, 9, 9, 5, 8, 28, 22, 35,
302             45, 48, 43, 13, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18,
303             3, 3, 21, 26, 9, 8, 24, 13, 10, 7, 12, 15, 21, 10, 20, 14, 9, 6
304             ],
305             [
306             33, 22, 35, 27, 23, 35, 27, 36, 18, 32, 31, 28, 25, 35, 33, 33, 28, 24, 29, 30, 31, 29, 35, 34, 28,
307             28, 27, 28, 27, 33, 31
308             ],
309             [ 18, 26, 22, 16, 20, 12, 29, 17, 18, 20, 10, 14 ],
310             [ 17, 17, 11, 16, 16, 13, 13, 14 ],
311             [
312             31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21,
313             13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23,
314             15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24
315             ],
316             [
317             19, 37, 25, 31, 31, 30, 34, 22, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10, 38,
318             24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46,
319             64, 34
320             ],
321             [ 22, 22, 66, 22, 22 ],
322             [
323             28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 49, 32, 31, 49, 27, 17,
324             21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35
325             ],
326             [ 21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13 ],
327             [ 11, 23, 5, 19, 15, 11, 16, 14, 17, 15, 12, 14, 16, 9 ],
328             [ 20, 32, 21 ],
329             [ 15, 16, 15, 13, 27, 14, 17, 14, 15 ],
330             [ 21 ],
331             [ 17, 10, 10, 11 ],
332             [ 16, 13, 12, 13, 15, 16, 20 ],
333             [ 15, 13, 19 ],
334             [ 17, 20, 19 ],
335             [ 18, 15, 20 ],
336             [ 15, 23 ],
337             [ 21, 13, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21 ],
338             [ 14, 17, 18, 6 ],
339             [
340             25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 27, 35, 30, 34, 46, 46, 39, 51,
341             46, 75, 66, 20
342             ],
343             [ 45, 28, 35, 41, 43, 56, 37, 38, 50, 52, 33, 44, 37, 72, 47, 20 ],
344             [ 80, 52, 38, 44, 39, 49, 50, 56, 62, 42, 54, 59, 35, 35, 32, 31, 37, 43, 48, 47, 38, 71, 56, 53 ],
345             [ 51, 25, 36, 54, 47, 71, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42, 31, 25 ],
346             [
347             26, 47, 26, 37, 42, 15, 60, 40, 43, 48, 30, 25, 52, 28, 41, 40, 34, 28, 41, 38, 40, 30, 35, 27, 27,
348             32, 44, 31
349             ],
350             [ 32, 29, 31, 25, 21, 23, 25, 39, 33, 21, 36, 21, 14, 23, 33, 27 ],
351             [ 31, 16, 23, 21, 13, 20, 40, 13, 27, 33, 34, 31, 13, 40, 58, 24 ],
352             [ 24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 14 ],
353             [ 24, 21, 29, 31, 26, 18 ],
354             [ 23, 22, 21, 32, 33, 24 ],
355             [ 30, 30, 21, 23 ],
356             [ 29, 23, 25, 18 ],
357             [ 10, 20, 13, 18, 28 ],
358             [ 12, 17, 18 ],
359             [ 20, 15, 16, 16, 25, 21 ],
360             [ 18, 26, 17, 22 ],
361             [ 16, 15, 15 ],
362             [ 25 ],
363             [ 14, 18, 19, 16, 14, 20, 28, 13, 28, 39, 40, 29, 25 ],
364             [ 27, 26, 18, 17, 20 ],
365             [ 25, 25, 22, 19, 14 ],
366             [ 21, 22, 18 ],
367             [ 10, 29, 24, 21, 21 ],
368             [ 13 ],
369             [ 15 ],
370             [ 25 ],
371             [ 20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 17, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21 ],
372             ],
373             Catholic => [
374             [
375             31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67,
376             34, 35, 46, 22, 35, 43, 55, 33, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22,
377             33, 26
378             ],
379             [
380             22, 25, 22, 31, 23, 30, 29, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 37, 31, 33, 18,
381             40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38
382             ],
383             [
384             17, 16, 17, 35, 26, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55,
385             46, 34
386             ],
387             [
388             54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 34, 45, 41, 50, 28, 32, 22, 30, 35, 41, 30, 25,
389             19, 65, 23, 31, 39, 17, 54, 42, 56, 29, 34, 13
390             ],
391             [
392             46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 32, 19, 29, 23, 22, 20, 22, 21, 20, 23, 30, 26, 22,
393             19, 19, 26, 69, 29, 20, 30, 52, 29, 12
394             ],
395             [ 18, 24, 17, 25, 16, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33 ],
396             [ 36, 23, 31, 24, 32, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25 ],
397             [ 22, 23, 18, 22 ],
398             [
399             28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 43, 16, 23, 28, 23,
400             44, 25, 12, 25, 11, 31, 13
401             ],
402             [ 27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 33, 44, 26, 22, 51, 39, 25 ],
403             [ 53, 46, 28, 34, 32, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 54 ],
404             [ 18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 22, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30 ],
405             [
406             54, 55, 24, 43, 41, 81, 40, 40, 44, 14, 47, 41, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31,
407             32, 34, 21, 30
408             ],
409             [
410             18, 18, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 23, 15, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27,
411             28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23
412             ],
413             [ 11, 70, 13, 24, 17, 22, 28, 36, 15, 44 ],
414             [ 11, 20, 38, 23, 19, 19, 73, 18, 38, 40, 36, 47, 31 ],
415             [ 25, 23, 25, 23, 28, 22, 20, 24, 12, 13, 21, 22, 23, 17 ],
416             [ 16, 28, 15, 16, 29, 21, 32, 36, 19, 23, 23, 20, 31, 19, 15, 31 ],
417             [ 22, 23, 15, 17, 14, 14, 10, 17, 32, 13, 12, 6, 18, 19, 19, 24 ],
418             [ 67, 70, 60, 61, 68, 63, 50, 32, 73, 89, 74, 54, 54, 49, 41, 24 ],
419             [ 36, 33, 40, 50, 27, 31, 42, 36, 29, 38, 38, 46, 26, 46, 40 ],
420             [
421             22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 23, 16, 21, 29, 29, 34, 30, 17, 25, 6,
422             14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 35, 32, 26, 17
423             ],
424             [
425             6, 13, 9, 10, 13, 11, 18, 10, 39, 18, 9, 9, 7, 7, 11, 15, 51, 51, 15, 14, 32, 32, 10, 22, 22, 14, 14,
426             10, 13, 25, 25, 22, 23, 28, 28, 40, 40, 23, 18, 18, 14, 12, 26, 27, 18, 12, 15, 21, 23, 23, 21, 11,
427             9, 24, 24, 14, 12, 18, 18, 14, 13, 13, 12, 14, 20, 20, 36, 37, 37, 24, 24, 28, 28, 23, 13, 21, 72, 72,
428             20, 20, 17, 19, 19, 14, 17, 17, 19, 53, 53, 17, 16, 16, 23, 23, 13, 13, 12, 9, 9, 8, 29, 29, 35,
429             45, 48, 48, 43, 31, 31, 10, 10, 10, 26, 9, 19, 19, 29, 176, 176, 8, 9, 9, 8, 8, 7, 6, 6, 8, 8, 8, 18,
430             18, 3, 21, 27, 26, 9, 24, 24, 14, 10, 12, 15, 21, 21, 11, 20, 14, 9, 6
431             ],
432             [
433             33, 22, 35, 27, 23, 35, 27, 36, 18, 32, 31, 28, 25, 35, 33, 33, 28, 24, 29, 30, 31, 29, 35, 34,
434             28, 28, 27, 28, 27, 33, 31
435             ],
436             [ 18, 26, 22, 17, 19, 12, 30, 17, 18, 20, 10, 14 ],
437             [ 17, 17, 11, 16, 17, 12, 14, 14 ],
438             [ 16, 25, 19, 20, 24, 27, 30, 21, 19, 21, 27, 27, 19, 31, 19, 29, 21, 25, 22 ],
439             [
440             40, 23, 34, 36, 18, 37, 40, 22, 25, 34, 36, 19, 32, 27, 22, 31, 32, 33, 30, 33, 31, 33, 38, 47,
441             36, 29, 33, 30, 34, 27, 42, 28, 33, 31, 26, 31, 34, 39, 41, 32, 28, 26, 37, 27, 31, 23, 31, 28,
442             19, 31, 38
443             ],
444             [
445             31, 22, 26, 6, 30, 13, 25, 23, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21,
446             13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 26, 13, 15, 22, 26, 11, 23,
447             15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24
448             ],
449             [
450             19, 37, 25, 31, 31, 30, 34, 23, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10,
451             38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39,
452             46, 64, 34
453             ],
454             [ 22, 22, 66, 22, 22 ],
455             [ 22, 35, 38, 37, 9, 72 ],
456             [
457             28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 49, 37, 31, 49, 27, 17,
458             21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35
459             ],
460             [ 21, 49, 100, 34, 31, 29, 28, 27, 27, 21, 45, 13, 65, 42 ],
461             [ 11, 25, 5, 19, 15, 11, 16, 14, 17, 15, 12, 15, 15, 10 ],
462             [ 20, 32, 21, 21 ],
463             [ 15, 16, 15, 13, 27, 15, 17, 14, 15 ],
464             [ 21 ],
465             [ 16, 11, 10, 11 ],
466             [ 16, 13, 12, 14, 14, 16, 20 ],
467             [ 15, 14, 19 ],
468             [ 17, 20, 19 ],
469             [ 18, 15, 20 ],
470             [ 15, 24 ],
471             [ 21, 17, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21 ],
472             [ 14, 17, 24, 6 ],
473             [
474             25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 27, 35, 30, 34, 46, 46, 39, 51,
475             46, 75, 66, 20
476             ],
477             [ 45, 28, 35, 41, 43, 56, 37, 39, 50, 52, 33, 44, 37, 72, 47, 20 ],
478             [ 80, 52, 38, 44, 39, 49, 50, 56, 62, 42, 54, 59, 35, 35, 32, 31, 37, 43, 48, 47, 38, 71, 56, 53 ],
479             [ 51, 25, 36, 54, 47, 72, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42, 31, 25 ],
480             [
481             26, 47, 26, 37, 42, 15, 60, 40, 43, 49, 30, 25, 52, 28, 41, 40, 34, 28, 40, 38, 40, 30, 35, 27,
482             27, 32, 44, 31
483             ],
484             [ 32, 29, 31, 25, 21, 23, 25, 39, 33, 21, 36, 21, 14, 23, 33, 27 ],
485             [ 31, 16, 23, 21, 13, 20, 40, 13, 27, 33, 34, 31, 13, 40, 58, 24 ],
486             [ 24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 13 ],
487             [ 24, 21, 29, 31, 26, 18 ],
488             [ 23, 22, 21, 32, 33, 24 ],
489             [ 30, 30, 21, 23 ],
490             [ 29, 23, 25, 18 ],
491             [ 10, 20, 13, 18, 28 ],
492             [ 12, 17, 18 ],
493             [ 20, 15, 16, 16, 25, 21 ],
494             [ 18, 26, 17, 22 ],
495             [ 16, 15, 15 ],
496             [ 25 ],
497             [ 14, 18, 19, 16, 14, 20, 28, 13, 28, 39, 40, 29, 25 ],
498             [ 27, 26, 18, 17, 20 ],
499             [ 25, 25, 22, 19, 14 ],
500             [ 21, 22, 18 ],
501             [ 10, 29, 24, 21, 21 ],
502             [ 13 ],
503             [ 15 ],
504             [ 25 ],
505             [ 20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21 ],
506             ],
507             Orthodox => [
508             [
509             31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67,
510             34, 35, 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22,
511             33, 26
512             ],
513             [
514             22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18,
515             40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38
516             ],
517             [
518             17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55,
519             46, 34
520             ],
521             [
522             54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22, 29, 35, 41, 30, 25,
523             18, 65, 23, 31, 40, 16, 54, 42, 56, 29, 34, 13
524             ],
525             [
526             46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 32, 18, 29, 23, 22, 20, 22, 21, 20, 23, 30, 25, 22,
527             19, 19, 26, 68, 29, 20, 30, 52, 29, 12
528             ],
529             [ 18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33 ],
530             [ 36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25 ],
531             [ 22, 23, 18, 22 ],
532             [
533             28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 42, 15, 23, 29, 22,
534             44, 25, 12, 25, 11, 31, 13
535             ],
536             [ 27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 33, 43, 26, 22, 51, 39, 25 ],
537             [ 53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 53 ],
538             [ 18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30 ],
539             [
540             54, 55, 24, 43, 26, 81, 40, 40, 44, 14, 47, 40, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31,
541             32, 34, 21, 30
542             ],
543             [
544             17, 18, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 22, 15, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27,
545             28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23
546             ],
547             [ 58, 30, 24, 63, 73, 34, 15, 96, 55 ],
548             [ 40, 48, 36, 52, 56, 59, 140, 63, 47, 59, 46, 51, 58, 48, 63, 78 ],
549             [ 11, 70, 13, 24, 17, 22, 28, 36, 15, 44 ],
550             [ 11, 20, 32, 23, 19, 19, 73, 18, 38, 39, 36, 47, 31 ],
551             [ 22, 14, 17, 21, 22, 18, 18, 21, 6, 13, 19, 22, 18, 15 ],
552             [ 16, 28, 10, 15, 24, 21, 32, 36, 14, 23, 23, 20, 20, 19, 14, 25 ],
553             [ 22, 23, 15, 17, 14, 14, 10, 17, 32, 3 ],
554             [ 22, 23, 15, 19, 14, 14, 10, 17, 32, 1 ],
555             [ 64, 70, 60, 61, 68, 63, 50, 32, 73, 89, 74, 53, 53, 49, 41, 24 ],
556             [ 36, 32, 40, 50, 27, 31, 42, 36, 29, 38, 38, 45, 26, 46, 39 ],
557             [ 29, 33, 30, 21, 51, 41, 23 ],
558             [ 35, 24, 21, 26, 38, 35, 23, 29, 32, 21, 27, 19, 27, 20, 32, 25, 24, 24 ],
559             [
560             22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29, 29, 34, 30, 17, 25, 6,
561             14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 30, 24, 34, 17
562             ],
563             [ 15 ],
564             [
565             6, 12, 8, 8, 12, 10, 17, 9, 20, 18, 7, 8, 6, 7, 5, 11, 15, 50, 14, 9, 13, 31, 6, 10, 22, 12, 14,
566             9, 11, 12, 24, 11, 22, 22, 28, 12, 40, 22, 13, 17, 13, 11, 5, 26, 17, 11, 9, 14, 20, 23, 19, 9,
567             6, 7, 23, 13, 11, 11, 17, 12, 8, 12, 11, 10, 13, 20, 7, 35, 36, 5, 24, 20, 28, 23, 10, 12, 20, 72,
568             13, 19, 16, 8, 18, 12, 13, 17, 7, 18, 52, 17, 16, 15, 5, 23, 11, 13, 12, 9, 9, 5, 8, 28, 22, 35,
569             45, 48, 43, 13, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18,
570             3, 3, 21, 26, 9, 8, 24, 13, 10, 7, 12, 15, 21, 10, 20, 14, 9, 6
571             ],
572             [
573             33, 22, 35, 27, 23, 35, 27, 36, 18, 32, 31, 28, 25, 35, 33, 33, 28,
574             24, 29, 30, 31, 29, 35, 34, 28, 28, 27, 28, 27, 33, 31
575             ],
576             [ 18, 26, 22, 16, 20, 12, 29, 17, 18, 20, 10, 14 ],
577             [ 17, 17, 11, 16, 16, 13, 13, 14 ],
578             [ 16, 24, 19, 20, 23, 25, 30, 21, 18, 21, 26, 27, 19, 31, 19, 29, 21, 25, 22 ],
579             [
580             30, 18, 31, 31, 15, 37, 36, 19, 18, 31, 34, 18, 26, 27, 20, 30, 32, 33, 30, 31, 28, 27, 27, 34,
581             26, 29, 30, 26, 28, 25, 31, 24, 33, 31, 26, 31, 31, 34, 35, 30, 23, 25, 33, 23, 26, 20, 25, 25,
582             16, 29, 30
583             ],
584             [
585             31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21,
586             13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23,
587             15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24
588             ],
589             [
590             19, 37, 25, 31, 31, 30, 34, 22, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10,
591             38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39,
592             46, 64, 34
593             ],
594             [ 22, 22, 66, 22, 22 ],
595             [ 22, 35, 37, 37, 9 ],
596             [ 73 ],
597             [ 64 ],
598             [ 42 ],
599             [ 68 ],
600             [
601             28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 49, 32, 31, 49, 27, 17,
602             21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35
603             ],
604             [ 21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13 ],
605             [ 11, 23, 5, 19, 15, 11, 16, 14, 17, 15, 12, 14, 16, 9 ],
606             [ 20, 32, 21 ],
607             [ 15, 16, 15, 13, 27, 14, 17, 14, 15 ],
608             [ 21 ],
609             [ 17, 10, 10, 11 ],
610             [ 16, 13, 12, 13, 15, 16, 20 ],
611             [ 15, 13, 19 ],
612             [ 17, 20, 19 ],
613             [ 18, 15, 20 ],
614             [ 15, 23 ],
615             [ 21, 13, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21 ],
616             [ 14, 17, 18, 6 ],
617             [
618             25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 27, 35, 30, 34, 46, 46, 39, 51,
619             46, 75, 66, 20
620             ],
621             [ 45, 28, 35, 41, 43, 56, 37, 38, 50, 52, 33, 44, 37, 72, 47, 20 ],
622             [ 80, 52, 38, 44, 39, 49, 50, 56, 62, 42, 54, 59, 35, 35, 32, 31, 37, 43, 48, 47, 38, 71, 56, 53 ],
623             [ 51, 25, 36, 54, 47, 71, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42, 31, 25 ],
624             [
625             26, 47, 26, 37, 42, 15, 60, 40, 43, 48, 30, 25, 52, 28, 41, 40, 34, 28, 41, 38, 40, 30, 35, 27, 27,
626             32, 44, 31
627             ],
628             [ 32, 29, 31, 25, 21, 23, 25, 39, 33, 21, 36, 21, 14, 23, 33, 27 ],
629             [ 31, 16, 23, 21, 13, 20, 40, 13, 27, 33, 34, 31, 13, 40, 58, 24 ],
630             [ 24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 14 ],
631             [ 24, 21, 29, 31, 26, 18 ],
632             [ 23, 22, 21, 32, 33, 24 ],
633             [ 30, 30, 21, 23 ],
634             [ 29, 23, 25, 18 ],
635             [ 10, 20, 13, 18, 28 ],
636             [ 12, 17, 18 ],
637             [ 20, 15, 16, 16, 25, 21 ],
638             [ 18, 26, 17, 22 ],
639             [ 16, 15, 15 ],
640             [ 25 ],
641             [ 14, 18, 19, 16, 14, 20, 28, 13, 28, 39, 40, 29, 25 ],
642             [ 27, 26, 18, 17, 20 ],
643             [ 25, 25, 22, 19, 14 ],
644             [ 21, 22, 18 ],
645             [ 10, 29, 24, 21, 21 ],
646             [ 13 ],
647             [ 15 ],
648             [ 25 ],
649             [ 20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21 ],
650             ],
651             };
652              
653             has _bible => 'Protestant';
654             has _bible_data => {};
655             has _data => [];
656             has _cache => {};
657              
658 19     19 1 24911 sub bible ( $self, $name = undef ) {
  19         44  
  19         43  
  19         34  
659 19 100       79 return $self->_bible unless ($name);
660              
661 15   50     107 my $input = lc( substr( $name || '', 0, 1 ) );
662 15         40 my ($bible) = grep { lc( substr( $_, 0, 1 ) ) eq $input } keys %{ $self->_bibles };
  52         317  
  15         74  
663 15 100       273 croak "Could not determine a valid Bible type from input" unless ($bible);
664 14         66 $self->_bible($bible);
665              
666 14         121 my $books = [ map { [@$_] } @{ $self->_bibles->{ $self->_bible } } ];
  959         2436  
  14         42  
667              
668 14         56 my $bible_data;
669 14         47 for my $book_data (@$books) {
670 959         1773 my ( $book, @acronyms ) = @$book_data;
671              
672 959         2467 $bible_data->{book_to_acronym}{$book} = $acronyms[0];
673 959         1229 push( @{ $bible_data->{books} }, $book );
  959         1877  
674             }
675 14         37 my $book_count;
676 14         39 $bible_data->{book_order} = { map { $_ => ++$book_count } @{ $bible_data->{books} } };
  959         1718  
  14         45  
677              
678 14         94 my $canonical = [ map { $_->[0] } @$books ];
  959         1430  
679 14         69 my $options = { map { shift @$_ => $_ } @$books };
  959         1706  
680             my $re_map = { map {
681 14         108 my $book = $_;
  959         1394  
682 959         1278 my $book_str = $_;
683 959 50       3441 my @prefix = (
    100          
    100          
    100          
    100          
684             ( $book_str =~ s/^(\d)\s// ) ? (
685             (
686             (
687             ( $1 == 1 ) ? ( qw( I First ) ) :
688             ( $1 == 2 ) ? ( qw( II Second ) ) :
689             ( $1 == 3 ) ? ( qw( III Third ) ) :
690             ( $1 == 4 ) ? ( qw( IV Fourth ) ) : ()
691             ),
692             $1 . '*',
693             ),
694             $1,
695             ) : ()
696             );
697              
698 959         2969 my @letters = split( '', $book_str );
699 959         1315 my $unique;
700 959         1954 while (@letters) {
701 2956         20190 $unique .= shift @letters;
702             last if (
703             length $unique >= $self->minimum_book_length
704             and (
705             not @prefix and
706             scalar( grep { index( $_, $unique ) == 0 } @$canonical ) == 1 or
707             @prefix and
708 2956 100 100     6671 scalar( grep { index( $_, $prefix[-1] . ' ' . $unique ) == 0 } @$canonical ) == 1
      100        
709             )
710             );
711             }
712              
713 959         2054 my @matches = $unique;
714 959         5114 push( @matches, $unique .= shift @letters ) while (@letters);
715              
716             @matches = map {
717 959         1610 my $match = $_;
  4926         7014  
718              
719 4926         6668 $match .= ')i?(';
720 4926         16388 $match =~ s/^(\w)/$1)i-?(/;
721              
722 4926 100       12547 (@prefix) ? ( map { ')' . $_ . ':i?(' . ' ' . $match } @prefix ) : $match;
  5400         11971  
723             } @matches;
724              
725             map {
726 11366         18000 my $re = reverse $_;
727              
728 11366         16869 $re =~ s/\*/'[A-z]+'/ge;
  1350         3080  
729 11366         21826 $re =~ s/\s+/'[\s_]*'/ge;
  6134         14540  
730              
731 11366         33268 $re => $book;
732 959         1881 } @matches, @{ $options->{$book} };
  959         2149  
733             } @$canonical };
734              
735 14         3450 my @re_parts = sort { length $b <=> length $a } keys %$re_map;
  91270         112896  
736              
737 14         505 my $re_refs = '(?i:[\d:,;\s\-]|\bdna\b|\bro\b|&)*\.?';
738 14         44 my $re_refs_req =
739             '(?i:[\d:,;\s\-]|\bdna\b|\bro\b|&)*' .
740             '(?:\d\s*:\s*\d)' .
741             '(?i:[\d:,;\s\-]|\bdna\b|\bro\b|&)*\.?';
742              
743 14         72 my $re_refs_string = '\b(' . join( '|', map { $re_refs . $_ } @re_parts ) . ')\b';
  11366         21413  
744 14         726 my $re_refs_req_string = '\b(' . join( '|', map { $re_refs_req . $_ } @re_parts ) . ')\b';
  11366         23576  
745              
746 14         527529 $bible_data->{re_refs_s} = qr/$re_refs_string/;
747 14         1674700 $bible_data->{re_refs_sr} = qr/$re_refs_req_string/;
748 14         7159 $bible_data->{re_books_s} = [ map { [ qr/\b$_\b/, $re_map->{$_} ] } @re_parts ];
  11366         150747  
749              
750 14         10610 $re_refs_string =~ s/\(\?\-?i\)//g;
751 14         10942 $re_refs_req_string =~ s/\(\?\-?i\)//g;
752              
753 14         464441 $bible_data->{re_refs_i} = qr/$re_refs_string/i;
754 14         1493833 $bible_data->{re_refs_ir} = qr/$re_refs_req_string/i;
755             $bible_data->{re_books_i} = [ map {
756 14         6291 my $this_book = $re_map->{$_};
  11366         27430  
757 11366         37385 s/\(\?\-?i\)//g;
758 11366         140322 [ qr/\b$_\b/i, $this_book ];
759             } @re_parts ];
760              
761             $bible_data->{lengths} = {
762             map {
763 959         8890 $bible_data->{books}[$_] => $self->_lengths->{$bible}[$_]
764 14         374 } 0 .. @{ $bible_data->{books} } - 1
  14         89  
765             };
766              
767 14         826 $self->_bible_data($bible_data);
768 14         86358 return $bible;
769             }
770              
771 2     2 1 130 sub new ( $self, %params ) {
  2         4  
  2         5  
  2         4  
772 2         18 $self = $self->SUPER::new(%params);
773 2   33     1656 $self->bible( $params{bible} || $self->_bible );
774 2         18 return $self;
775             }
776              
777 202     202   385 sub _list ( $start, $stop ) {
  202         278  
  202         282  
  202         279  
778 202 50       433 $start++ if ( $start == 0 );
779 202 50       389 $stop++ if ( $stop == 0 );
780              
781 202         735 my ( $x, $y ) = sort { $a <=> $b } $start, $stop;
  404         596  
782 202         574 my @list = $x .. $y;
783 202 100       439 @list = reverse(@list) if ( $x < $start );
784              
785 202         1283 return @list;
786             };
787              
788 180     180 1 296 sub expand_ranges ( $self, $book, $text, $compress = 0 ) {
  180         283  
  180         268  
  180         432  
  180         318  
  180         237  
789 178     178   246 my $expand = sub ( $start, $stop ) {
  178         244  
  178         389  
  178         299  
790 178 100       756 my $start_ch = ( $start =~ s/(\d+):// ) ? $1 : 0;
791 178 100       474 my $stop_ch = ( $stop =~ s/(\d+):// ) ? $1 : 0;
792              
793 178 100 100     729 if ( not $start_ch and $stop_ch and $start > $stop_ch ) {
      100        
794             # A: "5-3:4" = translated to "5:1-3:4"
795              
796 1         3 $start_ch = $start;
797 1         2 $start = 1;
798             }
799              
800 178         302 my $skip_chapter_assumption_check = 0;
801 178 100 100     585 if ( $start_ch and $stop_ch and $start and $stop and $start_ch == $stop_ch ) {
      66        
      66        
      66        
802 2 100       7 if ( $start <= $stop ) {
803             # B: "3:4-3:7" = translated to "3:4-7"
804              
805 1         3 $stop_ch = 0;
806             }
807             else {
808             # Q: "3:37-3:4" is the reverse of 3:4-3:37
809              
810 1         2 $stop_ch = 0;
811 1         2 $skip_chapter_assumption_check = 1;
812             }
813             }
814              
815 178         340 my $expance = '';
816              
817 178 100 100     819 if ( not $start_ch and not $stop_ch ) {
    100 100        
    100 66        
    50 33        
818             # C: "3-3" = consider as "3"
819             # D: "3-5" = consider as a simple range
820             # E: "5-3" = consider as a simple reversed range
821              
822 99         260 $expance = join( ',', _list( $start, $stop ) );
823             }
824              
825             elsif ( $start_ch and not $stop_ch ) {
826             # F: "1:3-15" = consider 3-15 as verses
827             # G: "1:15-3" = consider 3 a chapter
828             # H: "1:3-3" = consider the second 3 a chapter
829             # I: "3:2-3" = consider 2-3 as verses
830             # J: "3:3-2" = consider 3-2 as verses
831              
832 62 100 100     244 if ( $start >= $stop and $stop > $start_ch and not $skip_chapter_assumption_check ) {
      100        
833 4         8 $stop_ch = $stop;
834 4         15 $stop = $self->_bible_data->{lengths}{$book}[ $start_ch - 1 ];
835             }
836              
837 62 100       258 $expance = join( ';', grep { defined }
  124         340  
838             $start_ch . ':' . join( ',', _list( $start, $stop ) ),
839             ( ($stop_ch) ? join( ';', _list( $start_ch + 1, $stop_ch ) ) : undef ),
840             );
841             }
842              
843             elsif ( not $start_ch and $stop_ch ) {
844             # K: "3-5:2" = 3-4 are full chapters; plus 5:1-5:2
845             # L: "3-3:2" = interpretted as "3:1-2"
846              
847 10         26 $start_ch = $start;
848 10         23 $start = 1;
849              
850 10         34 $expance = join( ':',
851             join( ';', _list( $start_ch, $stop_ch ) ),
852             join( ',', _list( $start, $stop ) ),
853             );
854             }
855              
856             elsif ( $start_ch and $stop_ch ) {
857             # M: "3:4-4:7" becomes "3:4-*;4:1-7"
858             # N: "4:7-3:4" becomes reverse of "3:4-*;4:1-7"
859             # O: "3:4-5:2" becomes "3:4-*;4;5:1-2"
860             # P: "5:2-3:4" becomes reverse of "3:4-*;4;5:2-*"
861              
862 7         12 my $reversed = 0;
863 7 100       29 if ( $start_ch >= $stop_ch ) {
864 3         11 ( $start_ch, $stop_ch, $start, $stop ) = ( $stop_ch, $start_ch, $stop, $start );
865 3         5 $reversed = 1;
866             }
867              
868 7 100       25 my $reverse = sub { ($reversed) ? reverse(@_) : @_ };
  24         392  
869              
870 21         97 $expance = join( ';', grep { defined }
871             $reverse->(
872             $start_ch . ':' . join( ',', $reverse->( _list(
873             $start,
874 7 100       32 $self->_bible_data->{lengths}{$book}[ $start_ch - 1 ],
875             ) ) ),
876             (
877             ( $stop_ch - $start_ch > 1 )
878             ? join( ',', $reverse->( _list( $start_ch + 1, $stop_ch - 1 ) ) )
879             : undef
880             ),
881             $stop_ch . ':' . join( ',', $reverse->( _list( 1, $stop ) ) ),
882             ),
883             );
884             }
885              
886 178         831 $expance;
887 180         1790 };
888              
889 180         757 $text =~ s/[\s,]+/,/g;
890 180         525 $text =~ s/^,//g;
891 180         813 $text =~ s/(\d+(?::\d+)?)\-(\d+(?::\d+)?)/ $expand->( $1, $2 ) /ge;
  178         403  
892 180 50       448 $text =~ s/([,;])/$1 /g unless $compress;
893              
894 180         2446 return $text;
895             };
896              
897 19     19 1 11023 sub in ( $self, @input ) {
  19         40  
  19         87  
  19         39  
898 19 50       73 return $self unless (@input);
899              
900             my $re_refs = $self->_bible_data->{
901 19 100       69 're_refs_' .
    100          
902             ( ( $self->require_book_ucfirst ) ? 's' : 'i' ) .
903             ( ( $self->require_verse_match ) ? 'r' : '' )
904             };
905              
906             my $re_books = ( $self->require_book_ucfirst )
907             ? $self->_bible_data->{re_books_s}
908 19 100       674 : $self->_bible_data->{re_books_i};
909              
910 19         378 for my $string (@input) {
911 164   100     688 $string = scalar( reverse $string // '' );
912 164         263 my @processed;
913 164         229 while (1) {
914 492         634014 my ( $pre, $ref, $post ) = split( /$re_refs/, $string, 2 );
915 492 100       1904 last unless ($ref);
916              
917 328         874 $ref =~ s/(\d)([[:alpha:]])/$1 $2/;
918              
919 328         561 $string = $post;
920              
921 328 100       1375 my $space = ( $ref =~ s/^((?i:\W|\bdna\b|\bro\b|&)+)// ) ? $1 : '';
922 328         1219 $ref =~ s/\s+/ /g;
923 328         609 $pre = $pre . $space;
924 328         689 push( @processed, $pre );
925              
926 328         470 my $book;
927 328         698 for (@$re_books) {
928 148296 100       419234 if ( $ref =~ /$_->[0]/ ) {
929 328         834 $book = $_->[1];
930 328         677 last;
931             }
932             }
933              
934 328         735 my $ref_out = [$book];
935 328         738 my $numbers = [];
936              
937 328         1533 $ref =~ s/(?:\bdna\b|\bro\b|&)/,/g;
938 328         743 $ref = scalar reverse $ref;
939              
940 328 100       1237 if ( $ref =~ /([\d:,;\s\-]+)$/ ) {
941 159         646 my $range = $self->expand_ranges( $book, $1, 1 );
942              
943 159         297 my $verse_context = 0;
944 159         252 my $last_d = 0;
945              
946 159         897 while ( $range =~ s/^(\d+)([:,;]?)\D*//g ) {
947 1174   100     3731 my ( $d, $s ) = ( $1, $2 || '' );
948              
949 1174 100 100     3606 $verse_context = 0 if ( $s eq ':' or $d <= $last_d );
950              
951 1174 100       1907 unless ($verse_context) {
952 664         1656 push( @$numbers, [$d] );
953             }
954             else {
955 510 100       632 push( @{ $numbers->[-1] }, [] ) unless ( @{ $numbers->[-1] } > 1 );
  127         328  
  510         1138  
956 510         718 push( @{ $numbers->[-1][-1] }, $d );
  510         1045  
957             }
958              
959 1174 100       1977 $last_d = ($verse_context) ? $d : 0;
960              
961 1174 100       2002 $verse_context = 1 if ( $s eq ':' );
962 1174 100       4949 $verse_context = 0 if ( $s eq ';' );
963             }
964             }
965              
966 328 100       842 push( @$ref_out, $numbers ) if (@$numbers);
967 328         713 push( @processed, $ref_out );
968             }
969              
970 164         350 push( @processed, $string );
971             push(
972 164         661 @{ $self->_data },
973 164 100       284 [ grep { length } map { ( ref $_ ) ? $_ : scalar reverse $_ } reverse @processed ],
  820         1963  
  820         3888  
974             );
975             }
976              
977 19         145 return $self;
978             }
979              
980 18     18 1 94276 sub clear ($self) {
  18         49  
  18         34  
981 18         98 $self->_data([]);
982 18         866 return $self;
983             }
984              
985 4     4 1 610 sub books ($self) {
  4         11  
  4         7  
986 4 50       108 return (wantarray) ? @{ $self->_bible_data->{books} } : $self->_bible_data->{books};
  4         24  
987             }
988              
989 53     53 1 143862 sub as_array ( $self, $data = undef ) {
  53         105  
  53         89  
  53         84  
990 53 50 100     204 if (
      0        
      66        
991             $data or
992             not $self->_cache->{data} or
993             not (
994             $self->_cache->{sorting} and $self->_cache->{sorting} == $self->sorting and
995             $self->_cache->{acronyms} and $self->_cache->{acronyms} == $self->acronyms
996             )
997             ) {
998 53   100     570 $data //= [ map { grep { ref } @$_ } @{ $self->_data } ];
  192         510  
  932         1767  
  14         80  
999             $data = [
1000 53         124 map { [
1001             map {
1002 438         777 ( ref $_ ) ? [
1003             map {
1004 647 100       1660 ( ref $_ ) ? [
1005             map {
1006 902 100       1808 ( ref $_ ) ? [
  1067 50       4054  
1007             @$_
1008             ] : $_
1009             } @$_
1010             ] : $_
1011             } @$_
1012             ] : $_
1013             } @$_
1014             ] }
1015             @$data
1016             ];
1017              
1018             $data = [ map {
1019 53 100       196 my $book = $_->[0];
  39         72  
1020              
1021 39 100       68 if ( ref $_->[1] ) {
1022             $_->[1] = [ map {
1023 82   100     241 $_->[1] //= [ 1 .. ( $self->_bible_data->{lengths}{$book}[ $_->[0] - 1 ] || 0 ) ];
      100        
1024 82         1020 $_;
1025 19         25 } @{ $_->[1] } ];
  19         37  
1026             }
1027             else {
1028 20         27 my $chapter;
1029 20         26 $_->[1] = [ map { [ ++$chapter, [ 1 .. $_ ] ] } @{ $self->_bible_data->{lengths}{$book} } ];
  209         1188  
  20         45  
1030             }
1031              
1032 39         81 $_;
1033             } @$data ] if ( $self->add_detail );
1034              
1035 53 100       612 if ( $self->sorting ) {
1036 52         510 my $data_by_book = {};
1037 52 100       124 push( @{ $data_by_book->{ $_->[0] } }, @{ $_->[1] || [] } ) for (@$data);
  399         951  
  399         1310  
1038              
1039             $data = [
1040             map {
1041 246         908 my $book = [ $_->[1] ];
1042              
1043 246         337 my $dedup;
1044 246         323 for my $chapter ( @{ $data_by_book->{ $_->[1] } } ) {
  246         497  
1045 1029   100     4003 $dedup->{ $chapter->[0] } //= {};
1046 1029         1314 $dedup->{ $chapter->[0] }{$_} = 1 for ( @{ $chapter->[1] } );
  1029         7788  
1047             }
1048              
1049             my $chapters = [
1050             map {
1051 908         1818 my $chapter = [$_];
1052 908         1205 my @verses = keys %{ $dedup->{$_} };
  908         2555  
1053 908 100       1933 push( @$chapter, [ sort { $a <=> $b } @verses ] ) if @verses;
  24958         31793  
1054 908         1940 $chapter;
1055             }
1056 246         787 sort { $a <=> $b }
  2462         3360  
1057             keys %$dedup
1058             ];
1059              
1060 246 100       583 push( @$book, $chapters ) if (@$chapters);
1061              
1062 246         2140 $book;
1063             }
1064 643         1128 sort { $a->[0] <=> $b->[0] }
1065 52         199 map { [ $self->_bible_data->{book_order}{$_}, $_ ] }
  246         2247  
1066             keys %$data_by_book
1067             ];
1068             }
1069              
1070 53 100       260 if ( $self->acronyms ) {
1071 1         15 for (@$data) {
1072 22         201 $_->[0] = $self->_bible_data->{book_to_acronym}{ $_->[0] };
1073             }
1074             }
1075              
1076 53         595 $self->_cache->{data} = $data;
1077             }
1078              
1079 53 100       1745 return (wantarray) ? @{ $self->_cache->{data} } : $self->_cache->{data};
  1         5  
1080             }
1081              
1082 1     1 1 25 sub as_hash ( $self, $data = undef ) {
  1         3  
  1         3  
  1         2  
1083 1         3 my $build = {};
1084              
1085 1         5 for my $book_block ( $self->as_array($data) ) {
1086 22         52 my ( $book_name, $chapters ) = @$book_block;
1087              
1088 22         37 $build->{$book_name} = {};
1089 22         40 for (@$chapters) {
1090 77 100       90 push( @{ $build->{$book_name}{ $_->[0] } }, @{ $_->[1] || [] } );
  77         149  
  77         204  
1091             }
1092             }
1093              
1094 1 50       18 return (wantarray) ? %$build : $build;
1095             }
1096              
1097 83     83   118 sub _compress_range ( $items = [] ) {
  83         127  
  83         106  
1098 83         123 my ( $last, @items, @range );
1099              
1100             my $flush_range = sub {
1101 192 100   192   346 if (@range) {
1102 72         109 pop @items;
1103 72         166 push( @items, join( '-', $range[0], $range[-1] ) );
1104 72         169 @range = ();
1105             }
1106 83         245 };
1107              
1108 83         171 for my $item (@$items) {
1109 493 100 100     1160 if ( not $last or $last + 1 != $item ) {
1110 109         218 $flush_range->();
1111 109         188 push( @items, $item );
1112             }
1113             else {
1114 384         619 push( @range, $last, $item );
1115             }
1116              
1117 493         683 $last = $item;
1118             }
1119 83         164 $flush_range->();
1120              
1121 83 50       399 return (wantarray) ? @items : join( ', ', @items );
1122             }
1123              
1124 48     48   69 sub _as_type ( $self, $type, $data = undef ) {
  48         74  
  48         74  
  48         66  
  48         69  
1125 48         107 $data = $self->as_array($data);
1126              
1127             return [
1128             map {
1129 48         467 my $book = $_->[0];
  158         247  
1130              
1131 158 100       274 if ( $_->[1] ) {
1132 69         100 my ( @build, @buffer );
1133              
1134             my $flush_buffer = sub {
1135 76 100   76   186 if (@buffer) {
1136 24         51 push( @build, join( '; ', _compress_range(\@buffer) ) );
1137 24         52 @buffer = ();
1138             }
1139 69         223 };
1140              
1141 69         114 for ( @{ $_->[1] } ) {
  69         153  
1142 467         666 my $chapter = $_->[0];
1143              
1144 467 100       703 if ( $_->[1] ) {
1145 70 100       562 if ( $type eq 'verses' ) {
    100          
    100          
1146 11         16 push( @build, map { "$book $chapter:$_" } @{ $_->[1] } );
  58         119  
  11         21  
1147             }
1148             elsif ( $type eq 'runs' ) {
1149 11         23 push( @build, map { "$book $chapter:$_" } _compress_range( $_->[1] ) );
  14         46  
1150             }
1151             elsif ( $type eq 'chapters' ) {
1152 11         33 push( @build, "$book $chapter:" . join( ', ', _compress_range( $_->[1] ) ) );
1153             }
1154             else {
1155 37         79 $flush_buffer->();
1156 37         100 push( @build, $chapter . ':' . join( ', ', _compress_range( $_->[1] ) ) );
1157             }
1158             }
1159             else {
1160 397 100       573 unless ( $type eq 'books' ) {
1161 198         412 push( @build, "$book $chapter" );
1162             }
1163             else {
1164 199         417 push( @buffer, $chapter );
1165             }
1166             }
1167             }
1168              
1169 69 100       153 unless ( $type eq 'books' ) {
1170 30         232 @build;
1171             }
1172             else {
1173 39         88 $flush_buffer->();
1174 39         204 $book . ' ' . join( '; ', @build );
1175             }
1176             }
1177             else {
1178 89         190 $book;
1179             }
1180             } @$data
1181             ];
1182             }
1183              
1184 1     1 1 25 sub as_verses ( $self, $data = undef ) {
  1         2  
  1         4  
  1         2  
1185 1         5 my $items = $self->_as_type( 'verses', $data );
1186 1 50       7 return (wantarray) ? @$items : $items;
1187             }
1188              
1189 1     1 1 29 sub as_runs ( $self, $data = undef ) {
  1         3  
  1         3  
  1         2  
1190 1         7 my $items = $self->_as_type( 'runs', $data );
1191 1 50       6 return (wantarray) ? @$items : $items;
1192             }
1193              
1194 1     1 1 26 sub as_chapters ( $self, $data = undef ) {
  1         4  
  1         3  
  1         3  
1195 1         7 my $items = $self->_as_type( 'chapters', $data );
1196 1 50       6 return (wantarray) ? @$items : $items;
1197             }
1198              
1199 45     45 1 96 sub as_books ( $self, $data = undef ) {
  45         67  
  45         69  
  45         66  
1200 45         105 my $items = $self->_as_type( 'books', $data );
1201 45 100       231 return (wantarray) ? @$items : $items;
1202             }
1203              
1204 40     40 1 81 sub refs ( $self, $data = undef ) {
  40         55  
  40         62  
  40         57  
1205 40         84 return join( '; ', $self->as_books($data) );
1206             }
1207              
1208 1     1 1 27 sub as_text ($self) {
  1         3  
  1         2  
1209             my @text = map {
1210 18 100       48 join( '', map { ( ref $_ ) ? $self->refs([$_]) : $_ } @$_ );
  92         269  
1211 1         2 } @{ $self->_data };
  1         6  
1212              
1213             return
1214 1 50 33     20 ( @text > 1 and wantarray ) ? @text :
    50 33        
1215             ( @text > 1 and not wantarray ) ? \@text : join( ' ', @text );
1216             }
1217              
1218 4     4 1 5044 sub set_bible_data ( $self, $bible = undef, $data = undef ) {
  4         8  
  4         9  
  4         5  
  4         8  
1219 4 50 66     201 croak 'First argument to set_bible_data() must be a Bible name string'
      66        
1220             unless ( $bible and not ref $bible and length $bible > 0 );
1221 3 100 66     100 croak 'Second argument to set_bible_data() must be an arrayref of arrayrefs'
1222             unless ( $data and ref $data eq 'ARRAY' );
1223              
1224 2         5 for (@$data) {
1225 41 50 66     323 croak 'Second argument to set_bible_data() does not appear valid' unless (
      66        
      66        
      33        
1226             ref $_ eq 'ARRAY' and
1227             not ref $_->[0] and length $_->[0] > 0 and
1228             not ref $_->[1] and length $_->[1] > 0
1229             );
1230             }
1231              
1232 1         9 $self->_bibles->{$bible} = $data;
1233 1         16 $self->bible($bible);
1234 1         8 return $self;
1235             }
1236              
1237 1     1 1 2129 sub get_bible_structure ( $self, $bible = undef ) {
  1         4  
  1         3  
  1         2  
1238 1 50       7 $self->bible($bible) if ($bible);
1239 1         4 return [ map { [ $_, $self->_bible_data->{lengths}{$_} ] } @{ $self->_bible_data->{books} } ];
  83         793  
  1         7  
1240             }
1241              
1242 2     2 1 2647 sub identify_bible ( $self, @books ) {
  2         6  
  2         5  
  2         3  
1243 2 100       184 croak('No books supplied; must supply at least 1 input') unless (@books);
1244              
1245 1         8 my $obj = $self->new( minimum_book_length => $self->minimum_book_length );
1246              
1247             my $bibles = [
1248 5         13 sort { $b->{count} <=> $a->{count} }
1249             map {
1250 4         33 $obj->bible($_);
1251 4         137 my $books = scalar( $obj->clear->in(@books)->as_books );
1252             {
1253 4         31 name => $_,
1254             books => $books,
1255             count => scalar(@$books),
1256             };
1257             }
1258 1         5 keys %{ $obj->_bibles }
  1         7  
1259             ];
1260              
1261 4         16 $bibles = [ grep { $bibles->[0]{count} == $_->{count} } @$bibles ]
1262 1 50       9 if ( $bibles->[0]{count} != $bibles->[-1]{count} );
1263              
1264 1         5454 return $bibles;
1265             }
1266              
1267             1;
1268              
1269             __END__