[svn-upgrade] Integrating new upstream version, libhtml-widgets-navmenu-perl (1.0400)
Jonathan Yu
14 years ago
11 | 11 | { |
12 | 12 | 'Test::More' => 0, |
13 | 13 | 'Class::Accessor' => 0, |
14 | 'Error' => 0, | |
15 | 14 | 'perl' => "5.6.1", |
16 | 15 | 'IO::Scalar' => 0, |
17 | 16 | }, |
0 | 0 | Revision history for Perl extension Shlomif::NavMenu. |
1 | ||
2 | 1.0400 Wed Dec 9 11:44:05 IST 2009 | |
3 | - Got rid of the dependency on Error.pm. | |
4 | - moved the HTML/ directory with the test scripts-support code from | |
5 | the root of the distribution to unde t/lib . | |
1 | 6 | |
2 | 7 | 1.0302 Thu Jun 25 16:48:42 IDT 2009 |
3 | 8 | - Fixed some broken links and other inaccuracies in the POD of |
0 | package HTML::Widgets::NavMenu::Test::Data; | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use Exporter; | |
6 | use vars qw(@ISA); | |
7 | @ISA=qw(Exporter); | |
8 | ||
9 | use vars qw(@EXPORT); | |
10 | ||
11 | @EXPORT = qw(get_test_data); | |
12 | ||
13 | my @minimal_nav_menu = | |
14 | ( | |
15 | 'current_host' => "default", | |
16 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
17 | 'tree_contents' => | |
18 | { | |
19 | 'host' => "default", | |
20 | 'text' => "Top 1", | |
21 | 'title' => "T1 Title", | |
22 | 'subs' => | |
23 | [ | |
24 | { | |
25 | 'text' => "Home", | |
26 | 'url' => "", | |
27 | }, | |
28 | { | |
29 | 'text' => "About Me", | |
30 | 'title' => "About Myself", | |
31 | 'url' => "me/", | |
32 | }, | |
33 | ], | |
34 | }, | |
35 | ); | |
36 | ||
37 | my @two_sites_data = | |
38 | ( | |
39 | 'current_host' => "default", | |
40 | 'hosts' => | |
41 | { | |
42 | 'default' => | |
43 | { | |
44 | 'base_url' => "http://www.hello.com/", | |
45 | }, | |
46 | 'other' => | |
47 | { | |
48 | 'base_url' => "http://www.other-url.co.il/~shlomif/", | |
49 | }, | |
50 | }, | |
51 | 'tree_contents' => | |
52 | { | |
53 | 'host' => "default", | |
54 | 'text' => "Top 1", | |
55 | 'title' => "T1 Title", | |
56 | 'subs' => | |
57 | [ | |
58 | { | |
59 | 'text' => "Home", | |
60 | 'url' => "", | |
61 | }, | |
62 | { | |
63 | 'text' => "About Me", | |
64 | 'title' => "About Myself", | |
65 | 'url' => "me/", | |
66 | 'subs' => | |
67 | [ | |
68 | { | |
69 | 'url' => "round/hello/personal.html", | |
70 | 'text' => "Bio", | |
71 | 'title' => "Biography of Myself", | |
72 | }, | |
73 | { | |
74 | 'url' => "round/toto/", | |
75 | 'text' => "Gloria", | |
76 | 'title' => "A Useful Conspiracy", | |
77 | }, | |
78 | ], | |
79 | }, | |
80 | { | |
81 | 'text' => "Tam Tam Drums", | |
82 | 'title' => "Drumming is good for your health", | |
83 | 'url' => "hoola/", | |
84 | 'host' => "other", | |
85 | 'subs' => | |
86 | [ | |
87 | { | |
88 | 'url' => "hello/hoop.html", | |
89 | 'title' => "Hoola Hoops Rulez and Ownz!", | |
90 | 'text' => "Hoola Hoops", | |
91 | 'host' => "default", | |
92 | }, | |
93 | { | |
94 | 'url' => "tetra/", | |
95 | 'text' => "Tetrahedron", | |
96 | 'subs' => | |
97 | [ | |
98 | { | |
99 | 'url' => "tetra/one/", | |
100 | 'text' => "Tetra One", | |
101 | 'title' => "Tetra One Title", | |
102 | }, | |
103 | ], | |
104 | }, | |
105 | ], | |
106 | }, | |
107 | ], | |
108 | }, | |
109 | ); | |
110 | ||
111 | my @expand_re_nav_menu = | |
112 | ( | |
113 | 'current_host' => "default", | |
114 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
115 | 'tree_contents' => | |
116 | { | |
117 | 'host' => "default", | |
118 | 'text' => "Top 1", | |
119 | 'title' => "T1 Title", | |
120 | 'subs' => | |
121 | [ | |
122 | { | |
123 | 'text' => "Home", | |
124 | 'url' => "", | |
125 | }, | |
126 | { | |
127 | 'text' => "About Me", | |
128 | 'title' => "About Myself", | |
129 | 'url' => "me/", | |
130 | }, | |
131 | { | |
132 | 'text' => "Foo", | |
133 | 'title' => "Fooish", | |
134 | 'url' => "foo/", | |
135 | 'subs' => | |
136 | [ | |
137 | { | |
138 | 'text' => "Expanded", | |
139 | 'title' => "Expanded", | |
140 | 'url' => "foo/expanded/", | |
141 | 'expand' => { 're' => "", }, | |
142 | }, | |
143 | ], | |
144 | } | |
145 | ], | |
146 | }, | |
147 | ); | |
148 | ||
149 | my @show_always_nav_menu = | |
150 | ( | |
151 | 'current_host' => "default", | |
152 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
153 | 'tree_contents' => | |
154 | { | |
155 | 'host' => "default", | |
156 | 'text' => "Top 1", | |
157 | 'title' => "T1 Title", | |
158 | 'subs' => | |
159 | [ | |
160 | { | |
161 | 'text' => "Home", | |
162 | 'url' => "", | |
163 | }, | |
164 | { | |
165 | 'text' => "About Me", | |
166 | 'title' => "About Myself", | |
167 | 'url' => "me/", | |
168 | }, | |
169 | { | |
170 | 'text' => "Show Always", | |
171 | 'url' => "show-always/", | |
172 | 'show_always' => 1, | |
173 | 'subs' => | |
174 | [ | |
175 | { | |
176 | 'text' => "Gandalf", | |
177 | 'url' => "show-always/gandalf/", | |
178 | }, | |
179 | { | |
180 | 'text' => "Robin", | |
181 | 'url' => "robin/", | |
182 | 'subs' => | |
183 | [ | |
184 | { | |
185 | 'text' => "Hood", | |
186 | 'url' => "robin/hood/", | |
187 | }, | |
188 | ], | |
189 | }, | |
190 | { | |
191 | 'text' => "Queen Esther", | |
192 | 'url' => "esther/", | |
193 | 'subs' => | |
194 | [ | |
195 | { | |
196 | 'text' => "Haman", | |
197 | 'url' => "haman/", | |
198 | }, | |
199 | ], | |
200 | }, | |
201 | ], | |
202 | }, | |
203 | ], | |
204 | }, | |
205 | ); | |
206 | ||
207 | my @items_in_sub_nav_menu = | |
208 | ( | |
209 | 'current_host' => "default", | |
210 | 'hosts' => | |
211 | { | |
212 | 'default' => | |
213 | { | |
214 | 'base_url' => "http://www.hello.com/", | |
215 | }, | |
216 | }, | |
217 | 'tree_contents' => | |
218 | { | |
219 | 'host' => "default", | |
220 | 'text' => "Top 1", | |
221 | 'title' => "T1 Title", | |
222 | 'subs' => | |
223 | [ | |
224 | { | |
225 | 'text' => "Home", | |
226 | 'url' => "", | |
227 | }, | |
228 | { | |
229 | 'text' => "About Me", | |
230 | 'title' => "About Myself", | |
231 | 'url' => "me/", | |
232 | 'subs' => | |
233 | [ | |
234 | { | |
235 | 'url' => "me/bio.html", | |
236 | 'text' => "Bio", | |
237 | 'title' => "Biography of Myself", | |
238 | }, | |
239 | { | |
240 | 'url' => "me/gloria/", | |
241 | 'text' => "Gloria", | |
242 | 'title' => "A Useful Conspiracy", | |
243 | }, | |
244 | ], | |
245 | }, | |
246 | { | |
247 | 'text' => "Tam Tam Drums", | |
248 | 'title' => "Drumming is good for your health", | |
249 | 'url' => "hoola/", | |
250 | }, | |
251 | ], | |
252 | }, | |
253 | ); | |
254 | ||
255 | my @separator_nav_menu = | |
256 | ( | |
257 | 'current_host' => "default", | |
258 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
259 | 'tree_contents' => | |
260 | { | |
261 | 'host' => "default", | |
262 | 'text' => "Top 1", | |
263 | 'title' => "T1 Title", | |
264 | 'subs' => | |
265 | [ | |
266 | { | |
267 | 'text' => "Home", | |
268 | 'url' => "", | |
269 | }, | |
270 | { | |
271 | 'text' => "About Me", | |
272 | 'title' => "About Myself", | |
273 | 'url' => "me/", | |
274 | 'subs' => | |
275 | [ | |
276 | { | |
277 | 'text' => "Group Hug", | |
278 | 'url' => "me/group-hug/", | |
279 | }, | |
280 | { | |
281 | 'text' => "Cool I/O", | |
282 | 'url' => "me/cool-io/", | |
283 | }, | |
284 | { | |
285 | 'separator' => 1, | |
286 | 'skip' => 1, | |
287 | }, | |
288 | { | |
289 | 'text' => "Resume", | |
290 | 'url' => "resume.html", | |
291 | }, | |
292 | ], | |
293 | }, | |
294 | { | |
295 | 'separator' => 1, | |
296 | 'skip' => 1, | |
297 | }, | |
298 | { | |
299 | 'text' => "Halifax", | |
300 | 'url' => "halifax/", | |
301 | }, | |
302 | ], | |
303 | }, | |
304 | ); | |
305 | ||
306 | my @hidden_item_nav_menu = | |
307 | ( | |
308 | 'current_host' => "default", | |
309 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
310 | 'tree_contents' => | |
311 | { | |
312 | 'host' => "default", | |
313 | 'text' => "Top 1", | |
314 | 'title' => "T1 Title", | |
315 | 'subs' => | |
316 | [ | |
317 | { | |
318 | 'text' => "Home", | |
319 | 'url' => "", | |
320 | }, | |
321 | { | |
322 | 'text' => "About Me", | |
323 | 'title' => "About Myself", | |
324 | 'url' => "me/", | |
325 | 'subs' => | |
326 | [ | |
327 | { | |
328 | 'text' => "Visible", | |
329 | 'url' => "me/visible/", | |
330 | }, | |
331 | { | |
332 | 'text' => "Hidden", | |
333 | 'url' => "me/hidden/", | |
334 | 'hide' => 1, | |
335 | }, | |
336 | { | |
337 | 'text' => "Visible Too", | |
338 | 'url' => "me/visible-too/", | |
339 | }, | |
340 | ], | |
341 | }, | |
342 | ], | |
343 | }, | |
344 | ); | |
345 | ||
346 | my @header_role_nav_menu = | |
347 | ( | |
348 | 'current_host' => "default", | |
349 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
350 | 'tree_contents' => | |
351 | { | |
352 | 'host' => "default", | |
353 | 'text' => "Top 1", | |
354 | 'title' => "T1 Title", | |
355 | 'subs' => | |
356 | [ | |
357 | { | |
358 | 'text' => "Home", | |
359 | 'url' => "", | |
360 | }, | |
361 | { | |
362 | 'text' => "About Me", | |
363 | 'title' => "About Myself", | |
364 | 'url' => "me/", | |
365 | 'role' => "header", | |
366 | 'show_always' => 1, | |
367 | 'subs' => | |
368 | [ | |
369 | { | |
370 | 'text' => "Sub Me", | |
371 | 'url' => "me/sub-me1/", | |
372 | }, | |
373 | { | |
374 | 'text' => "Sub Me 2", | |
375 | 'url' => "me/sub-me-two/", | |
376 | }, | |
377 | ], | |
378 | }, | |
379 | { | |
380 | 'text' => "Hello", | |
381 | 'url' => "aloha/", | |
382 | 'show_always' => 1, | |
383 | 'role' => "notexist", | |
384 | 'subs' => | |
385 | [ | |
386 | { | |
387 | 'text' => "OBKB", | |
388 | 'url' => "aloha/obkb/", | |
389 | }, | |
390 | ], | |
391 | }, | |
392 | ], | |
393 | }, | |
394 | ); | |
395 | ||
396 | my @selective_expand_nav_menu = | |
397 | ( | |
398 | 'current_host' => "default", | |
399 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
400 | 'tree_contents' => | |
401 | { | |
402 | 'host' => "default", | |
403 | 'text' => "Top 1", | |
404 | 'title' => "T1 Title", | |
405 | 'subs' => | |
406 | [ | |
407 | { | |
408 | 'text' => "Home", | |
409 | 'url' => "", | |
410 | }, | |
411 | { | |
412 | 'text' => "About Me", | |
413 | 'title' => "About Myself", | |
414 | 'url' => "me/", | |
415 | 'expand' => { 're' => "^me/", }, | |
416 | 'subs' => | |
417 | [ | |
418 | { | |
419 | 'text' => "Group Hug", | |
420 | 'url' => "me/group-hug/", | |
421 | }, | |
422 | { | |
423 | 'text' => "Cool I/O", | |
424 | 'url' => "me/cool-io/", | |
425 | }, | |
426 | { | |
427 | 'text' => "Resume", | |
428 | 'url' => "resume.html", | |
429 | }, | |
430 | ], | |
431 | }, | |
432 | { | |
433 | 'text' => "Halifax", | |
434 | 'url' => "halifax/", | |
435 | }, | |
436 | { | |
437 | 'text' => "Software", | |
438 | 'title' => "Open Source Software I Wrote", | |
439 | 'url' => "open-source/", | |
440 | 'expand' => { 're' => "^open-source/", }, | |
441 | 'subs' => | |
442 | [ | |
443 | { | |
444 | 'text' => "Fooware", | |
445 | 'url' => "open-source/fooware/", | |
446 | }, | |
447 | { | |
448 | 'text' => "Condor-Man", | |
449 | 'title' => "Kwalitee", | |
450 | 'url' => "open-source/condor-man/", | |
451 | }, | |
452 | ], | |
453 | }, | |
454 | ], | |
455 | }, | |
456 | ); | |
457 | ||
458 | my @url_type_menu = | |
459 | ( | |
460 | 'current_host' => "default", | |
461 | 'hosts' => | |
462 | { | |
463 | 'default' => | |
464 | { | |
465 | 'base_url' => "http://www.hello.com/", | |
466 | 'trailing_url_base' => "/", | |
467 | }, | |
468 | }, | |
469 | 'tree_contents' => | |
470 | { | |
471 | 'host' => "default", | |
472 | 'text' => "Top 1", | |
473 | 'title' => "T1 Title", | |
474 | 'subs' => | |
475 | [ | |
476 | { | |
477 | 'text' => "Home", | |
478 | 'url' => "", | |
479 | }, | |
480 | { | |
481 | 'text' => "About Me", | |
482 | 'title' => "About Myself", | |
483 | 'url' => "me/", | |
484 | 'url_type' => "site_abs", | |
485 | }, | |
486 | { | |
487 | 'text' => "Yowza", | |
488 | 'url' => "yowza/", | |
489 | 'url_type' => "full_abs", | |
490 | }, | |
491 | ], | |
492 | }, | |
493 | ); | |
494 | ||
495 | my @rec_url_type_menu = | |
496 | ( | |
497 | 'current_host' => "default", | |
498 | 'hosts' => | |
499 | { | |
500 | 'default' => | |
501 | { | |
502 | 'base_url' => "http://www.hello.com/~shlomif/", | |
503 | 'trailing_url_base' => "/~shlomif/", | |
504 | }, | |
505 | }, | |
506 | 'tree_contents' => | |
507 | { | |
508 | 'host' => "default", | |
509 | 'text' => "Top 1", | |
510 | 'title' => "T1 Title", | |
511 | 'rec_url_type' => "full_abs", | |
512 | 'subs' => | |
513 | [ | |
514 | { | |
515 | 'text' => "Home", | |
516 | 'url' => "", | |
517 | }, | |
518 | { | |
519 | 'text' => "About Me", | |
520 | 'title' => "About Myself", | |
521 | 'url' => "me/", | |
522 | 'url_type' => "site_abs", | |
523 | }, | |
524 | { | |
525 | 'text' => "Hoola", | |
526 | 'url' => "tedious/to/write/", | |
527 | }, | |
528 | { | |
529 | 'text' => "Yowza", | |
530 | 'url' => "yowza/", | |
531 | 'url_type' => "rel", | |
532 | 'show_always' => 1, | |
533 | 'subs' => | |
534 | [ | |
535 | { | |
536 | 'url' => "yowza/howza/", | |
537 | 'text' => "This should be full_abs again", | |
538 | }, | |
539 | ], | |
540 | }, | |
541 | ], | |
542 | }, | |
543 | ); | |
544 | ||
545 | my @url_is_abs_nav_menu = | |
546 | ( | |
547 | 'current_host' => "default", | |
548 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
549 | 'tree_contents' => | |
550 | { | |
551 | 'host' => "default", | |
552 | 'text' => "Top 1", | |
553 | 'title' => "T1 Title", | |
554 | 'subs' => | |
555 | [ | |
556 | { | |
557 | 'text' => "Home", | |
558 | 'url' => "", | |
559 | }, | |
560 | { | |
561 | 'text' => "Link to Google", | |
562 | 'title' => "Google it!", | |
563 | 'url' => "http://www.google.com/", | |
564 | 'url_is_abs' => 1, | |
565 | 'expand' => { 'bool' => 0, }, | |
566 | 'subs' => | |
567 | [ | |
568 | { | |
569 | 'url' => "sub-dir/", | |
570 | 'text' => "Sub Directory", | |
571 | }, | |
572 | ], | |
573 | }, | |
574 | ], | |
575 | }, | |
576 | ); | |
577 | ||
578 | sub mixed_expand_nav_menu_cb1 | |
579 | { | |
580 | my %args = (@_); | |
581 | my $host = $args{'current_host'}; | |
582 | my $path_info = $args{'path_info'}; | |
583 | return (($host eq "other") && ($path_info =~ m!^open-source/!)); | |
584 | } | |
585 | ||
586 | sub mixed_expand_nav_menu_cb2 | |
587 | { | |
588 | my %args = (@_); | |
589 | my $host = $args{'current_host'}; | |
590 | my $path_info = $args{'path_info'}; | |
591 | return (($host eq "default") && ($path_info =~ m!^me/!)); | |
592 | } | |
593 | ||
594 | ||
595 | my @mixed_expand_nav_menu = | |
596 | ( | |
597 | 'hosts' => { | |
598 | 'default' => { 'base_url' => "http://www.default.net/", }, | |
599 | 'other' => { 'base_url' => "http://www.other.org/", }, | |
600 | }, | |
601 | 'tree_contents' => | |
602 | { | |
603 | 'host' => "default", | |
604 | 'text' => "Top 1", | |
605 | 'title' => "T1 Title", | |
606 | 'subs' => | |
607 | [ | |
608 | { | |
609 | 'text' => "Home", | |
610 | 'url' => "", | |
611 | }, | |
612 | { | |
613 | 'text' => "About Me", | |
614 | 'title' => "About Myself", | |
615 | 'url' => "me/", | |
616 | 'expand' => { 'cb' => \&mixed_expand_nav_menu_cb2, }, | |
617 | 'subs' => | |
618 | [ | |
619 | { | |
620 | 'text' => "Group Hug", | |
621 | 'url' => "me/group-hug/", | |
622 | }, | |
623 | { | |
624 | 'text' => "Cool I/O", | |
625 | 'url' => "me/cool-io/", | |
626 | }, | |
627 | { | |
628 | 'text' => "Resume", | |
629 | 'url' => "resume.html", | |
630 | }, | |
631 | ], | |
632 | }, | |
633 | { | |
634 | 'text' => "Halifax", | |
635 | 'url' => "halifax/", | |
636 | }, | |
637 | { | |
638 | 'text' => "Software", | |
639 | 'title' => "Open Source Software I Wrote", | |
640 | 'url' => "open-source/", | |
641 | 'host' => "other", | |
642 | 'expand' => { 'cb' => \&mixed_expand_nav_menu_cb1, }, | |
643 | 'subs' => | |
644 | [ | |
645 | { | |
646 | 'text' => "Fooware", | |
647 | 'url' => "open-source/fooware/", | |
648 | }, | |
649 | { | |
650 | 'text' => "Condor-Man", | |
651 | 'title' => "Kwalitee", | |
652 | 'url' => "open-source/condor-man/", | |
653 | }, | |
654 | ], | |
655 | }, | |
656 | ], | |
657 | }, | |
658 | ); | |
659 | ||
660 | my @special_chars_nav_menu = | |
661 | ( | |
662 | 'current_host' => "default", | |
663 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
664 | 'tree_contents' => | |
665 | { | |
666 | 'host' => "default", | |
667 | 'text' => "Top 1", | |
668 | 'title' => "T1 Title", | |
669 | 'subs' => | |
670 | [ | |
671 | { | |
672 | 'text' => "Home", | |
673 | 'url' => "", | |
674 | }, | |
675 | { | |
676 | 'text' => "Special Chars", | |
677 | 'url' => "<hello>&\"you\"/", | |
678 | }, | |
679 | { | |
680 | 'text' => "Non-special", | |
681 | 'url' => "non-special/", | |
682 | }, | |
683 | ], | |
684 | }, | |
685 | ); | |
686 | ||
687 | my @with_skips_nav_menu = | |
688 | ( | |
689 | 'current_host' => "default", | |
690 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
691 | 'tree_contents' => | |
692 | { | |
693 | 'host' => "default", | |
694 | 'text' => "Top 1", | |
695 | 'title' => "T1 Title", | |
696 | 'subs' => | |
697 | [ | |
698 | { | |
699 | 'text' => "Home", | |
700 | 'url' => "", | |
701 | }, | |
702 | { | |
703 | 'text' => "About Me", | |
704 | 'title' => "About Myself", | |
705 | 'url' => "me/", | |
706 | 'expand' => { 're' => "^me/", }, | |
707 | 'subs' => | |
708 | [ | |
709 | { | |
710 | 'text' => "Group Hug", | |
711 | 'url' => "me/group-hug/", | |
712 | }, | |
713 | { | |
714 | 'text' => "Cool I/O", | |
715 | 'url' => "me/cool-io/", | |
716 | }, | |
717 | { | |
718 | 'text' => "Resume", | |
719 | 'url' => "resume.html", | |
720 | }, | |
721 | ], | |
722 | }, | |
723 | { | |
724 | 'text' => "Halifax", | |
725 | 'url' => "halifax/", | |
726 | 'skip' => 1, | |
727 | }, | |
728 | { | |
729 | 'text' => "Software", | |
730 | 'title' => "Open Source Software I Wrote", | |
731 | 'url' => "open-source/", | |
732 | 'expand' => { 're' => "^open-source/", }, | |
733 | 'subs' => | |
734 | [ | |
735 | { | |
736 | 'text' => "Fooware", | |
737 | 'url' => "open-source/fooware/", | |
738 | 'skip' => 1, | |
739 | }, | |
740 | { | |
741 | 'text' => "Condor-Man", | |
742 | 'title' => "Kwalitee", | |
743 | 'url' => "open-source/condor-man/", | |
744 | }, | |
745 | ], | |
746 | }, | |
747 | ], | |
748 | }, | |
749 | ); | |
750 | ||
751 | my @root_path_not_slash = | |
752 | ( | |
753 | 'current_host' => "default", | |
754 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
755 | 'tree_contents' => | |
756 | { | |
757 | 'host' => "default", | |
758 | 'text' => "Top 1", | |
759 | 'title' => "T1 Title", | |
760 | 'subs' => | |
761 | [ | |
762 | { | |
763 | 'text' => "Home", | |
764 | 'url' => "puzzles/", | |
765 | subs => | |
766 | [ | |
767 | { | |
768 | url => "puzzles/foo/", | |
769 | 'text' => "The Foo Puzzle", | |
770 | }, | |
771 | { | |
772 | url => "puzzles/bar/", | |
773 | text => "The Bar Puzzle", | |
774 | }, | |
775 | ], | |
776 | }, | |
777 | { | |
778 | 'text' => "About Me", | |
779 | 'title' => "About Myself", | |
780 | 'url' => "puzzles/me/", | |
781 | }, | |
782 | ], | |
783 | }, | |
784 | ); | |
785 | ||
786 | my @non_capturing_expand = | |
787 | ( | |
788 | 'current_host' => "default", | |
789 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
790 | 'tree_contents' => | |
791 | { | |
792 | 'host' => "default", | |
793 | 'text' => "Top 1", | |
794 | 'title' => "T1 Title", | |
795 | 'subs' => | |
796 | [ | |
797 | { | |
798 | 'text' => "Home", | |
799 | 'url' => "", | |
800 | }, | |
801 | { | |
802 | 'text' => "Humour", | |
803 | 'url' => "humour/", | |
804 | 'expand' => { 're' => "^humour/", }, | |
805 | 'title' => "My Humorous Creations", | |
806 | 'subs' => | |
807 | [ | |
808 | { | |
809 | 'text' => "Stories", | |
810 | 'url' => "humour/stories/", | |
811 | 'title' => "Large-Scale Stories I Wrote", | |
812 | 'expand' => { 're' => "^humour/", capt => 0,}, | |
813 | 'subs' => | |
814 | [ | |
815 | { | |
816 | 'text' => "The Enemy", | |
817 | 'url' => "humour/TheEnemy/", | |
818 | }, | |
819 | { | |
820 | 'text' => "TOW The Fountainhead", | |
821 | 'url' => "humour/TOWTF/", | |
822 | }, | |
823 | ], | |
824 | }, | |
825 | { | |
826 | 'text' => "By Others", | |
827 | 'url' => "humour/by-others/", | |
828 | 'expand' => { 're' => "^humour/by-others/", }, | |
829 | }, | |
830 | ], | |
831 | } | |
832 | ], | |
833 | }, | |
834 | ); | |
835 | ||
836 | ||
837 | my @non_capturing_expand_reversed = | |
838 | ( | |
839 | 'current_host' => "default", | |
840 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
841 | 'tree_contents' => | |
842 | { | |
843 | 'host' => "default", | |
844 | 'text' => "Top 1", | |
845 | 'title' => "T1 Title", | |
846 | 'subs' => | |
847 | [ | |
848 | { | |
849 | 'text' => "Home", | |
850 | 'url' => "", | |
851 | }, | |
852 | { | |
853 | 'text' => "Humour", | |
854 | 'url' => "humour/", | |
855 | 'expand' => { 're' => "^humour/", }, | |
856 | 'title' => "My Humorous Creations", | |
857 | 'subs' => | |
858 | [ | |
859 | { | |
860 | 'text' => "Stories", | |
861 | 'url' => "humour/stories/", | |
862 | 'title' => "Large-Scale Stories I Wrote", | |
863 | 'subs' => | |
864 | [ | |
865 | { | |
866 | 'text' => "The Enemy", | |
867 | 'url' => "humour/TheEnemy/", | |
868 | }, | |
869 | { | |
870 | 'text' => "TOW The Fountainhead", | |
871 | 'url' => "humour/TOWTF/", | |
872 | }, | |
873 | ], | |
874 | }, | |
875 | { | |
876 | 'text' => "By Others", | |
877 | 'url' => "humour/by-others/", | |
878 | 'expand' => { 're' => "^humour/", capt => 0, }, | |
879 | subs => | |
880 | [ | |
881 | { | |
882 | text => "Foo", | |
883 | url => "humour/by-others/foo.html", | |
884 | }, | |
885 | ], | |
886 | }, | |
887 | ], | |
888 | } | |
889 | ], | |
890 | }, | |
891 | ); | |
892 | ||
893 | ||
894 | my @non_capturing_expand_nested = | |
895 | ( | |
896 | 'current_host' => "default", | |
897 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
898 | 'tree_contents' => | |
899 | { | |
900 | 'host' => "default", | |
901 | 'text' => "Top 1", | |
902 | 'title' => "T1 Title", | |
903 | 'subs' => | |
904 | [ | |
905 | { | |
906 | 'text' => "Home", | |
907 | 'url' => "", | |
908 | }, | |
909 | { | |
910 | 'text' => "Humour", | |
911 | 'url' => "humour/", | |
912 | 'expand' => { 're' => "^humour/", }, | |
913 | 'title' => "My Humorous Creations", | |
914 | 'subs' => | |
915 | [ | |
916 | { | |
917 | 'text' => "Stories", | |
918 | 'url' => "humour/stories/", | |
919 | 'expand' => { 're' => "^humour/", 'capt' => 0 }, | |
920 | 'title' => "Large-Scale Stories I Wrote", | |
921 | 'subs' => | |
922 | [ | |
923 | { | |
924 | 'text' => "The Enemy", | |
925 | 'url' => "humour/TheEnemy/", | |
926 | }, | |
927 | { | |
928 | 'text' => "TOW The Fountainhead", | |
929 | 'url' => "humour/TOWTF/", | |
930 | }, | |
931 | ], | |
932 | }, | |
933 | { | |
934 | 'text' => "By Others", | |
935 | 'url' => "humour/by-others/", | |
936 | 'expand' => { 're' => "^humour/", capt => 0, }, | |
937 | subs => | |
938 | [ | |
939 | { | |
940 | text => "Foo", | |
941 | url => "humour/by-others/foo.html", | |
942 | }, | |
943 | ], | |
944 | }, | |
945 | ], | |
946 | } | |
947 | ], | |
948 | }, | |
949 | ); | |
950 | ||
951 | my @header_role_with_empty_cat_nav_menu = | |
952 | ( | |
953 | 'current_host' => "default", | |
954 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
955 | 'tree_contents' => | |
956 | { | |
957 | 'host' => "default", | |
958 | 'text' => "Top 1", | |
959 | 'title' => "T1 Title", | |
960 | 'subs' => | |
961 | [ | |
962 | { | |
963 | 'text' => "Home", | |
964 | 'url' => "", | |
965 | }, | |
966 | { | |
967 | 'text' => "Empty Category", | |
968 | 'url' => "empty-cat/", | |
969 | 'role' => "header", | |
970 | 'show_always' => 1, | |
971 | }, | |
972 | { | |
973 | 'text' => "About Me", | |
974 | 'title' => "About Myself", | |
975 | 'url' => "me/", | |
976 | 'role' => "header", | |
977 | 'show_always' => 1, | |
978 | 'subs' => | |
979 | [ | |
980 | { | |
981 | 'text' => "Sub Me", | |
982 | 'url' => "me/sub-me1/", | |
983 | }, | |
984 | { | |
985 | 'text' => "Sub Me 2", | |
986 | 'url' => "me/sub-me-two/", | |
987 | }, | |
988 | ], | |
989 | }, | |
990 | { | |
991 | 'text' => "Hello", | |
992 | 'url' => "aloha/", | |
993 | 'show_always' => 1, | |
994 | 'role' => "notexist", | |
995 | 'subs' => | |
996 | [ | |
997 | { | |
998 | 'text' => "OBKB", | |
999 | 'url' => "aloha/obkb/", | |
1000 | }, | |
1001 | ], | |
1002 | }, | |
1003 | ], | |
1004 | }, | |
1005 | ); | |
1006 | ||
1007 | sub get_test_data | |
1008 | { | |
1009 | return | |
1010 | { | |
1011 | 'two_sites' => \@two_sites_data, | |
1012 | 'minimal' => \@minimal_nav_menu, | |
1013 | 'expand_re' => \@expand_re_nav_menu, | |
1014 | 'show_always' => \@show_always_nav_menu, | |
1015 | 'items_in_sub' => \@items_in_sub_nav_menu, | |
1016 | 'separator' => \@separator_nav_menu, | |
1017 | 'hidden_item' => \@hidden_item_nav_menu, | |
1018 | 'header_role' => \@header_role_nav_menu, | |
1019 | 'selective_expand' => \@selective_expand_nav_menu, | |
1020 | 'url_type_menu' => \@url_type_menu, | |
1021 | 'rec_url_type_menu' => \@rec_url_type_menu, | |
1022 | 'url_is_abs_menu' => \@url_is_abs_nav_menu, | |
1023 | 'mixed_expand_menu' => \@mixed_expand_nav_menu, | |
1024 | 'special_chars_menu' => \@special_chars_nav_menu, | |
1025 | 'with_skips' => \@with_skips_nav_menu, | |
1026 | 'root_path_not_slash' => \@root_path_not_slash, | |
1027 | 'non_capturing_expand' => \@non_capturing_expand, | |
1028 | 'non_capturing_expand_reversed' => \@non_capturing_expand_reversed, | |
1029 | 'non_capturing_expand_nested' => \@non_capturing_expand_nested, | |
1030 | 'header_role_with_empty_cat' => \@header_role_with_empty_cat_nav_menu | |
1031 | }; | |
1032 | } | |
1033 | ||
1034 | 1; |
0 | use strict; | |
1 | use warnings; | |
2 | ||
3 | use IO::Scalar; | |
4 | ||
5 | open SAVEOUT, ">&STDOUT"; | |
6 | print SAVEOUT ""; | |
7 | ||
8 | my $buffer = ""; | |
9 | ||
10 | tie *STDOUT, 'IO::Scalar', \$buffer; | |
11 | ||
12 | sub reset_out_buffer | |
13 | { | |
14 | $buffer = ""; | |
15 | } | |
16 | ||
17 | sub get_out_buffer | |
18 | { | |
19 | return $buffer; | |
20 | } | |
21 | ||
22 | 1; | |
23 |
0 | package HTML::Widgets::NavMenu::Test::Util; | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use Exporter; | |
6 | use vars qw(@ISA); | |
7 | @ISA=qw(Exporter); | |
8 | ||
9 | use vars qw(@EXPORT); | |
10 | ||
11 | @EXPORT = qw(compare_string_arrays); | |
12 | ||
13 | sub compare_string_arrays | |
14 | { | |
15 | my $arr1 = shift; | |
16 | my $arr2 = shift; | |
17 | my $len_cmp = (@$arr1 <=> @$arr2); | |
18 | if ($len_cmp) | |
19 | { | |
20 | print STDERR "Len is not the same: Expected " . scalar(@$arr1) . " vs. Result " . scalar(@$arr2) . "\n"; | |
21 | return $len_cmp; | |
22 | } | |
23 | my $i; | |
24 | for($i=0;$i<@$arr1;$i++) | |
25 | { | |
26 | my $item_cmp = $arr1->[$i] cmp $arr2->[$i]; | |
27 | if ($item_cmp) | |
28 | { | |
29 | print STDERR "Item[$i] is not the same:\nExpected: $arr1->[$i]\nResult: $arr2->[$i]\n"; | |
30 | return $item_cmp; | |
31 | } | |
32 | } | |
33 | return 0; | |
34 | } | |
35 | ||
36 | 1; |
6 | 6 | examples/article-examples/simple/H-W-NM-simple.pl |
7 | 7 | examples/article-examples/with-embellishments/H-W-NM-embellish.pl |
8 | 8 | examples/README |
9 | HTML/Widgets/NavMenu/Test/Data.pm | |
10 | HTML/Widgets/NavMenu/Test/Stdout.pm | |
11 | HTML/Widgets/NavMenu/Test/Util.pm | |
12 | 9 | inc/Test/Run/Builder.pm |
13 | 10 | lib/HTML/Widgets/NavMenu/EscapeHtml.pm |
14 | 11 | lib/HTML/Widgets/NavMenu/ExpandVal.pm |
50 | 47 | t/16redirect.t |
51 | 48 | t/17nav-coords-unit.t |
52 | 49 | t/18url.t |
50 | t/lib/HTML/Widgets/NavMenu/Test/Data.pm | |
51 | t/lib/HTML/Widgets/NavMenu/Test/Stdout.pm | |
52 | t/lib/HTML/Widgets/NavMenu/Test/Util.pm | |
53 | 53 | TODO |
54 | 54 | TODO-Rejects |
55 | 55 | t/pod-coverage.t |
0 | 0 | --- |
1 | 1 | name: HTML-Widgets-NavMenu |
2 | version: 1.0302 | |
2 | version: 1.0400 | |
3 | 3 | author: |
4 | 4 | - |- |
5 | 5 | Shlomi Fish E<lt>shlomif@iglu.org.ilE<gt> |
12 | 12 | repository: http://svn.berlios.de/svnroot/repos/web-cpan/nav-menu/ |
13 | 13 | requires: |
14 | 14 | Class::Accessor: 0 |
15 | Error: 0 | |
16 | 15 | IO::Scalar: 0 |
17 | 16 | Test::More: 0 |
18 | perl: 5.6.1 | |
17 | perl: v5.6.1 | |
18 | configure_requires: | |
19 | Module::Build: 0.35 | |
19 | 20 | provides: |
20 | 21 | HTML::Widgets::NavMenu: |
21 | 22 | file: lib/HTML/Widgets/NavMenu.pm |
22 | version: 1.0302 | |
23 | version: 1.0400 | |
23 | 24 | HTML::Widgets::NavMenu::Error: |
24 | 25 | file: lib/HTML/Widgets/NavMenu.pm |
25 | 26 | HTML::Widgets::NavMenu::Error::Redirect: |
64 | 65 | file: lib/HTML/Widgets/NavMenu/Tree/Node.pm |
65 | 66 | HTML::Widgets::NavMenu::Url: |
66 | 67 | file: lib/HTML/Widgets/NavMenu/Url.pm |
67 | generated_by: Module::Build version 0.33 | |
68 | generated_by: Module::Build version 0.35 | |
68 | 69 | meta-spec: |
69 | 70 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
70 | 71 | version: 1.4 |
2 | 2 | |
3 | 3 | package HTML::Widgets::NavMenu; |
4 | 4 | |
5 | our $VERSION = '1.0302'; | |
5 | our $VERSION = '1.0400'; | |
6 | 6 | |
7 | 7 | package HTML::Widgets::NavMenu::Error; |
8 | 8 | |
9 | use Error qw(:try); | |
10 | ||
11 | use base "Error"; | |
9 | use base "HTML::Widgets::NavMenu::Object"; | |
12 | 10 | |
13 | 11 | package HTML::Widgets::NavMenu::Error::Redirect; |
14 | 12 | |
20 | 18 | { |
21 | 19 | my $self = shift; |
22 | 20 | |
23 | my $q = shift; | |
24 | ||
25 | print $q->redirect($q->script_name() . $self->{-redirect_path}); | |
21 | my $cgi = shift; | |
22 | ||
23 | print $cgi->redirect($cgi->script_name() . $self->{-redirect_path}); | |
26 | 24 | exit; |
27 | 25 | } |
28 | 26 | |
173 | 171 | use base 'HTML::Widgets::NavMenu::Object'; |
174 | 172 | |
175 | 173 | use HTML::Widgets::NavMenu::Url; |
176 | use Error qw(:try); | |
177 | 174 | |
178 | 175 | require HTML::Widgets::NavMenu::Iterator::NavMenu; |
179 | 176 | require HTML::Widgets::NavMenu::Iterator::SiteMap; |
268 | 265 | |
269 | 266 | if (defined($redir_path)) |
270 | 267 | { |
271 | throw HTML::Widgets::NavMenu::Error::Redirect | |
272 | -redirect_path => ($redir_path."/"); | |
268 | my $error = HTML::Widgets::NavMenu::Error::Redirect->new(); | |
269 | ||
270 | $error->{'-redirect_path'} = ($redir_path."/"); | |
271 | $error->{'msg'} = "Need to redirect"; | |
272 | ||
273 | die $error; | |
273 | 274 | } |
274 | 275 | |
275 | 276 | $path_info =~ s!^\/!!; |
1026 | 1027 | =item 'nav_links_obj' |
1027 | 1028 | |
1028 | 1029 | This points to a hash reference whose keys are link IDs for |
1029 | the Firefox "Site Navigatoin Toolbar" | |
1030 | the Firefox "Site Navigation Toolbar" | |
1030 | 1031 | ( L<http://www.bolwin.com/software/snb.shtml> ) and compatible programs, |
1031 | 1032 | and its values are Node Description objects. (see "The Node Description |
1032 | 1033 | Class" below). Here's a sample code that renders the links as |
31 | 31 | { |
32 | 32 | *CORE::GLOBAL::exit = sub { $exit_count++; }; |
33 | 33 | } |
34 | ||
35 | use lib './t/lib'; | |
34 | 36 | |
35 | 37 | use Test::More tests => 6; |
36 | 38 |
0 | package HTML::Widgets::NavMenu::Test::Data; | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use Exporter; | |
6 | use vars qw(@ISA); | |
7 | @ISA=qw(Exporter); | |
8 | ||
9 | use vars qw(@EXPORT); | |
10 | ||
11 | @EXPORT = qw(get_test_data); | |
12 | ||
13 | my @minimal_nav_menu = | |
14 | ( | |
15 | 'current_host' => "default", | |
16 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
17 | 'tree_contents' => | |
18 | { | |
19 | 'host' => "default", | |
20 | 'text' => "Top 1", | |
21 | 'title' => "T1 Title", | |
22 | 'subs' => | |
23 | [ | |
24 | { | |
25 | 'text' => "Home", | |
26 | 'url' => "", | |
27 | }, | |
28 | { | |
29 | 'text' => "About Me", | |
30 | 'title' => "About Myself", | |
31 | 'url' => "me/", | |
32 | }, | |
33 | ], | |
34 | }, | |
35 | ); | |
36 | ||
37 | my @two_sites_data = | |
38 | ( | |
39 | 'current_host' => "default", | |
40 | 'hosts' => | |
41 | { | |
42 | 'default' => | |
43 | { | |
44 | 'base_url' => "http://www.hello.com/", | |
45 | }, | |
46 | 'other' => | |
47 | { | |
48 | 'base_url' => "http://www.other-url.co.il/~shlomif/", | |
49 | }, | |
50 | }, | |
51 | 'tree_contents' => | |
52 | { | |
53 | 'host' => "default", | |
54 | 'text' => "Top 1", | |
55 | 'title' => "T1 Title", | |
56 | 'subs' => | |
57 | [ | |
58 | { | |
59 | 'text' => "Home", | |
60 | 'url' => "", | |
61 | }, | |
62 | { | |
63 | 'text' => "About Me", | |
64 | 'title' => "About Myself", | |
65 | 'url' => "me/", | |
66 | 'subs' => | |
67 | [ | |
68 | { | |
69 | 'url' => "round/hello/personal.html", | |
70 | 'text' => "Bio", | |
71 | 'title' => "Biography of Myself", | |
72 | }, | |
73 | { | |
74 | 'url' => "round/toto/", | |
75 | 'text' => "Gloria", | |
76 | 'title' => "A Useful Conspiracy", | |
77 | }, | |
78 | ], | |
79 | }, | |
80 | { | |
81 | 'text' => "Tam Tam Drums", | |
82 | 'title' => "Drumming is good for your health", | |
83 | 'url' => "hoola/", | |
84 | 'host' => "other", | |
85 | 'subs' => | |
86 | [ | |
87 | { | |
88 | 'url' => "hello/hoop.html", | |
89 | 'title' => "Hoola Hoops Rulez and Ownz!", | |
90 | 'text' => "Hoola Hoops", | |
91 | 'host' => "default", | |
92 | }, | |
93 | { | |
94 | 'url' => "tetra/", | |
95 | 'text' => "Tetrahedron", | |
96 | 'subs' => | |
97 | [ | |
98 | { | |
99 | 'url' => "tetra/one/", | |
100 | 'text' => "Tetra One", | |
101 | 'title' => "Tetra One Title", | |
102 | }, | |
103 | ], | |
104 | }, | |
105 | ], | |
106 | }, | |
107 | ], | |
108 | }, | |
109 | ); | |
110 | ||
111 | my @expand_re_nav_menu = | |
112 | ( | |
113 | 'current_host' => "default", | |
114 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
115 | 'tree_contents' => | |
116 | { | |
117 | 'host' => "default", | |
118 | 'text' => "Top 1", | |
119 | 'title' => "T1 Title", | |
120 | 'subs' => | |
121 | [ | |
122 | { | |
123 | 'text' => "Home", | |
124 | 'url' => "", | |
125 | }, | |
126 | { | |
127 | 'text' => "About Me", | |
128 | 'title' => "About Myself", | |
129 | 'url' => "me/", | |
130 | }, | |
131 | { | |
132 | 'text' => "Foo", | |
133 | 'title' => "Fooish", | |
134 | 'url' => "foo/", | |
135 | 'subs' => | |
136 | [ | |
137 | { | |
138 | 'text' => "Expanded", | |
139 | 'title' => "Expanded", | |
140 | 'url' => "foo/expanded/", | |
141 | 'expand' => { 're' => "", }, | |
142 | }, | |
143 | ], | |
144 | } | |
145 | ], | |
146 | }, | |
147 | ); | |
148 | ||
149 | my @show_always_nav_menu = | |
150 | ( | |
151 | 'current_host' => "default", | |
152 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
153 | 'tree_contents' => | |
154 | { | |
155 | 'host' => "default", | |
156 | 'text' => "Top 1", | |
157 | 'title' => "T1 Title", | |
158 | 'subs' => | |
159 | [ | |
160 | { | |
161 | 'text' => "Home", | |
162 | 'url' => "", | |
163 | }, | |
164 | { | |
165 | 'text' => "About Me", | |
166 | 'title' => "About Myself", | |
167 | 'url' => "me/", | |
168 | }, | |
169 | { | |
170 | 'text' => "Show Always", | |
171 | 'url' => "show-always/", | |
172 | 'show_always' => 1, | |
173 | 'subs' => | |
174 | [ | |
175 | { | |
176 | 'text' => "Gandalf", | |
177 | 'url' => "show-always/gandalf/", | |
178 | }, | |
179 | { | |
180 | 'text' => "Robin", | |
181 | 'url' => "robin/", | |
182 | 'subs' => | |
183 | [ | |
184 | { | |
185 | 'text' => "Hood", | |
186 | 'url' => "robin/hood/", | |
187 | }, | |
188 | ], | |
189 | }, | |
190 | { | |
191 | 'text' => "Queen Esther", | |
192 | 'url' => "esther/", | |
193 | 'subs' => | |
194 | [ | |
195 | { | |
196 | 'text' => "Haman", | |
197 | 'url' => "haman/", | |
198 | }, | |
199 | ], | |
200 | }, | |
201 | ], | |
202 | }, | |
203 | ], | |
204 | }, | |
205 | ); | |
206 | ||
207 | my @items_in_sub_nav_menu = | |
208 | ( | |
209 | 'current_host' => "default", | |
210 | 'hosts' => | |
211 | { | |
212 | 'default' => | |
213 | { | |
214 | 'base_url' => "http://www.hello.com/", | |
215 | }, | |
216 | }, | |
217 | 'tree_contents' => | |
218 | { | |
219 | 'host' => "default", | |
220 | 'text' => "Top 1", | |
221 | 'title' => "T1 Title", | |
222 | 'subs' => | |
223 | [ | |
224 | { | |
225 | 'text' => "Home", | |
226 | 'url' => "", | |
227 | }, | |
228 | { | |
229 | 'text' => "About Me", | |
230 | 'title' => "About Myself", | |
231 | 'url' => "me/", | |
232 | 'subs' => | |
233 | [ | |
234 | { | |
235 | 'url' => "me/bio.html", | |
236 | 'text' => "Bio", | |
237 | 'title' => "Biography of Myself", | |
238 | }, | |
239 | { | |
240 | 'url' => "me/gloria/", | |
241 | 'text' => "Gloria", | |
242 | 'title' => "A Useful Conspiracy", | |
243 | }, | |
244 | ], | |
245 | }, | |
246 | { | |
247 | 'text' => "Tam Tam Drums", | |
248 | 'title' => "Drumming is good for your health", | |
249 | 'url' => "hoola/", | |
250 | }, | |
251 | ], | |
252 | }, | |
253 | ); | |
254 | ||
255 | my @separator_nav_menu = | |
256 | ( | |
257 | 'current_host' => "default", | |
258 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
259 | 'tree_contents' => | |
260 | { | |
261 | 'host' => "default", | |
262 | 'text' => "Top 1", | |
263 | 'title' => "T1 Title", | |
264 | 'subs' => | |
265 | [ | |
266 | { | |
267 | 'text' => "Home", | |
268 | 'url' => "", | |
269 | }, | |
270 | { | |
271 | 'text' => "About Me", | |
272 | 'title' => "About Myself", | |
273 | 'url' => "me/", | |
274 | 'subs' => | |
275 | [ | |
276 | { | |
277 | 'text' => "Group Hug", | |
278 | 'url' => "me/group-hug/", | |
279 | }, | |
280 | { | |
281 | 'text' => "Cool I/O", | |
282 | 'url' => "me/cool-io/", | |
283 | }, | |
284 | { | |
285 | 'separator' => 1, | |
286 | 'skip' => 1, | |
287 | }, | |
288 | { | |
289 | 'text' => "Resume", | |
290 | 'url' => "resume.html", | |
291 | }, | |
292 | ], | |
293 | }, | |
294 | { | |
295 | 'separator' => 1, | |
296 | 'skip' => 1, | |
297 | }, | |
298 | { | |
299 | 'text' => "Halifax", | |
300 | 'url' => "halifax/", | |
301 | }, | |
302 | ], | |
303 | }, | |
304 | ); | |
305 | ||
306 | my @hidden_item_nav_menu = | |
307 | ( | |
308 | 'current_host' => "default", | |
309 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
310 | 'tree_contents' => | |
311 | { | |
312 | 'host' => "default", | |
313 | 'text' => "Top 1", | |
314 | 'title' => "T1 Title", | |
315 | 'subs' => | |
316 | [ | |
317 | { | |
318 | 'text' => "Home", | |
319 | 'url' => "", | |
320 | }, | |
321 | { | |
322 | 'text' => "About Me", | |
323 | 'title' => "About Myself", | |
324 | 'url' => "me/", | |
325 | 'subs' => | |
326 | [ | |
327 | { | |
328 | 'text' => "Visible", | |
329 | 'url' => "me/visible/", | |
330 | }, | |
331 | { | |
332 | 'text' => "Hidden", | |
333 | 'url' => "me/hidden/", | |
334 | 'hide' => 1, | |
335 | }, | |
336 | { | |
337 | 'text' => "Visible Too", | |
338 | 'url' => "me/visible-too/", | |
339 | }, | |
340 | ], | |
341 | }, | |
342 | ], | |
343 | }, | |
344 | ); | |
345 | ||
346 | my @header_role_nav_menu = | |
347 | ( | |
348 | 'current_host' => "default", | |
349 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
350 | 'tree_contents' => | |
351 | { | |
352 | 'host' => "default", | |
353 | 'text' => "Top 1", | |
354 | 'title' => "T1 Title", | |
355 | 'subs' => | |
356 | [ | |
357 | { | |
358 | 'text' => "Home", | |
359 | 'url' => "", | |
360 | }, | |
361 | { | |
362 | 'text' => "About Me", | |
363 | 'title' => "About Myself", | |
364 | 'url' => "me/", | |
365 | 'role' => "header", | |
366 | 'show_always' => 1, | |
367 | 'subs' => | |
368 | [ | |
369 | { | |
370 | 'text' => "Sub Me", | |
371 | 'url' => "me/sub-me1/", | |
372 | }, | |
373 | { | |
374 | 'text' => "Sub Me 2", | |
375 | 'url' => "me/sub-me-two/", | |
376 | }, | |
377 | ], | |
378 | }, | |
379 | { | |
380 | 'text' => "Hello", | |
381 | 'url' => "aloha/", | |
382 | 'show_always' => 1, | |
383 | 'role' => "notexist", | |
384 | 'subs' => | |
385 | [ | |
386 | { | |
387 | 'text' => "OBKB", | |
388 | 'url' => "aloha/obkb/", | |
389 | }, | |
390 | ], | |
391 | }, | |
392 | ], | |
393 | }, | |
394 | ); | |
395 | ||
396 | my @selective_expand_nav_menu = | |
397 | ( | |
398 | 'current_host' => "default", | |
399 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
400 | 'tree_contents' => | |
401 | { | |
402 | 'host' => "default", | |
403 | 'text' => "Top 1", | |
404 | 'title' => "T1 Title", | |
405 | 'subs' => | |
406 | [ | |
407 | { | |
408 | 'text' => "Home", | |
409 | 'url' => "", | |
410 | }, | |
411 | { | |
412 | 'text' => "About Me", | |
413 | 'title' => "About Myself", | |
414 | 'url' => "me/", | |
415 | 'expand' => { 're' => "^me/", }, | |
416 | 'subs' => | |
417 | [ | |
418 | { | |
419 | 'text' => "Group Hug", | |
420 | 'url' => "me/group-hug/", | |
421 | }, | |
422 | { | |
423 | 'text' => "Cool I/O", | |
424 | 'url' => "me/cool-io/", | |
425 | }, | |
426 | { | |
427 | 'text' => "Resume", | |
428 | 'url' => "resume.html", | |
429 | }, | |
430 | ], | |
431 | }, | |
432 | { | |
433 | 'text' => "Halifax", | |
434 | 'url' => "halifax/", | |
435 | }, | |
436 | { | |
437 | 'text' => "Software", | |
438 | 'title' => "Open Source Software I Wrote", | |
439 | 'url' => "open-source/", | |
440 | 'expand' => { 're' => "^open-source/", }, | |
441 | 'subs' => | |
442 | [ | |
443 | { | |
444 | 'text' => "Fooware", | |
445 | 'url' => "open-source/fooware/", | |
446 | }, | |
447 | { | |
448 | 'text' => "Condor-Man", | |
449 | 'title' => "Kwalitee", | |
450 | 'url' => "open-source/condor-man/", | |
451 | }, | |
452 | ], | |
453 | }, | |
454 | ], | |
455 | }, | |
456 | ); | |
457 | ||
458 | my @url_type_menu = | |
459 | ( | |
460 | 'current_host' => "default", | |
461 | 'hosts' => | |
462 | { | |
463 | 'default' => | |
464 | { | |
465 | 'base_url' => "http://www.hello.com/", | |
466 | 'trailing_url_base' => "/", | |
467 | }, | |
468 | }, | |
469 | 'tree_contents' => | |
470 | { | |
471 | 'host' => "default", | |
472 | 'text' => "Top 1", | |
473 | 'title' => "T1 Title", | |
474 | 'subs' => | |
475 | [ | |
476 | { | |
477 | 'text' => "Home", | |
478 | 'url' => "", | |
479 | }, | |
480 | { | |
481 | 'text' => "About Me", | |
482 | 'title' => "About Myself", | |
483 | 'url' => "me/", | |
484 | 'url_type' => "site_abs", | |
485 | }, | |
486 | { | |
487 | 'text' => "Yowza", | |
488 | 'url' => "yowza/", | |
489 | 'url_type' => "full_abs", | |
490 | }, | |
491 | ], | |
492 | }, | |
493 | ); | |
494 | ||
495 | my @rec_url_type_menu = | |
496 | ( | |
497 | 'current_host' => "default", | |
498 | 'hosts' => | |
499 | { | |
500 | 'default' => | |
501 | { | |
502 | 'base_url' => "http://www.hello.com/~shlomif/", | |
503 | 'trailing_url_base' => "/~shlomif/", | |
504 | }, | |
505 | }, | |
506 | 'tree_contents' => | |
507 | { | |
508 | 'host' => "default", | |
509 | 'text' => "Top 1", | |
510 | 'title' => "T1 Title", | |
511 | 'rec_url_type' => "full_abs", | |
512 | 'subs' => | |
513 | [ | |
514 | { | |
515 | 'text' => "Home", | |
516 | 'url' => "", | |
517 | }, | |
518 | { | |
519 | 'text' => "About Me", | |
520 | 'title' => "About Myself", | |
521 | 'url' => "me/", | |
522 | 'url_type' => "site_abs", | |
523 | }, | |
524 | { | |
525 | 'text' => "Hoola", | |
526 | 'url' => "tedious/to/write/", | |
527 | }, | |
528 | { | |
529 | 'text' => "Yowza", | |
530 | 'url' => "yowza/", | |
531 | 'url_type' => "rel", | |
532 | 'show_always' => 1, | |
533 | 'subs' => | |
534 | [ | |
535 | { | |
536 | 'url' => "yowza/howza/", | |
537 | 'text' => "This should be full_abs again", | |
538 | }, | |
539 | ], | |
540 | }, | |
541 | ], | |
542 | }, | |
543 | ); | |
544 | ||
545 | my @url_is_abs_nav_menu = | |
546 | ( | |
547 | 'current_host' => "default", | |
548 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
549 | 'tree_contents' => | |
550 | { | |
551 | 'host' => "default", | |
552 | 'text' => "Top 1", | |
553 | 'title' => "T1 Title", | |
554 | 'subs' => | |
555 | [ | |
556 | { | |
557 | 'text' => "Home", | |
558 | 'url' => "", | |
559 | }, | |
560 | { | |
561 | 'text' => "Link to Google", | |
562 | 'title' => "Google it!", | |
563 | 'url' => "http://www.google.com/", | |
564 | 'url_is_abs' => 1, | |
565 | 'expand' => { 'bool' => 0, }, | |
566 | 'subs' => | |
567 | [ | |
568 | { | |
569 | 'url' => "sub-dir/", | |
570 | 'text' => "Sub Directory", | |
571 | }, | |
572 | ], | |
573 | }, | |
574 | ], | |
575 | }, | |
576 | ); | |
577 | ||
578 | sub mixed_expand_nav_menu_cb1 | |
579 | { | |
580 | my %args = (@_); | |
581 | my $host = $args{'current_host'}; | |
582 | my $path_info = $args{'path_info'}; | |
583 | return (($host eq "other") && ($path_info =~ m!^open-source/!)); | |
584 | } | |
585 | ||
586 | sub mixed_expand_nav_menu_cb2 | |
587 | { | |
588 | my %args = (@_); | |
589 | my $host = $args{'current_host'}; | |
590 | my $path_info = $args{'path_info'}; | |
591 | return (($host eq "default") && ($path_info =~ m!^me/!)); | |
592 | } | |
593 | ||
594 | ||
595 | my @mixed_expand_nav_menu = | |
596 | ( | |
597 | 'hosts' => { | |
598 | 'default' => { 'base_url' => "http://www.default.net/", }, | |
599 | 'other' => { 'base_url' => "http://www.other.org/", }, | |
600 | }, | |
601 | 'tree_contents' => | |
602 | { | |
603 | 'host' => "default", | |
604 | 'text' => "Top 1", | |
605 | 'title' => "T1 Title", | |
606 | 'subs' => | |
607 | [ | |
608 | { | |
609 | 'text' => "Home", | |
610 | 'url' => "", | |
611 | }, | |
612 | { | |
613 | 'text' => "About Me", | |
614 | 'title' => "About Myself", | |
615 | 'url' => "me/", | |
616 | 'expand' => { 'cb' => \&mixed_expand_nav_menu_cb2, }, | |
617 | 'subs' => | |
618 | [ | |
619 | { | |
620 | 'text' => "Group Hug", | |
621 | 'url' => "me/group-hug/", | |
622 | }, | |
623 | { | |
624 | 'text' => "Cool I/O", | |
625 | 'url' => "me/cool-io/", | |
626 | }, | |
627 | { | |
628 | 'text' => "Resume", | |
629 | 'url' => "resume.html", | |
630 | }, | |
631 | ], | |
632 | }, | |
633 | { | |
634 | 'text' => "Halifax", | |
635 | 'url' => "halifax/", | |
636 | }, | |
637 | { | |
638 | 'text' => "Software", | |
639 | 'title' => "Open Source Software I Wrote", | |
640 | 'url' => "open-source/", | |
641 | 'host' => "other", | |
642 | 'expand' => { 'cb' => \&mixed_expand_nav_menu_cb1, }, | |
643 | 'subs' => | |
644 | [ | |
645 | { | |
646 | 'text' => "Fooware", | |
647 | 'url' => "open-source/fooware/", | |
648 | }, | |
649 | { | |
650 | 'text' => "Condor-Man", | |
651 | 'title' => "Kwalitee", | |
652 | 'url' => "open-source/condor-man/", | |
653 | }, | |
654 | ], | |
655 | }, | |
656 | ], | |
657 | }, | |
658 | ); | |
659 | ||
660 | my @special_chars_nav_menu = | |
661 | ( | |
662 | 'current_host' => "default", | |
663 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
664 | 'tree_contents' => | |
665 | { | |
666 | 'host' => "default", | |
667 | 'text' => "Top 1", | |
668 | 'title' => "T1 Title", | |
669 | 'subs' => | |
670 | [ | |
671 | { | |
672 | 'text' => "Home", | |
673 | 'url' => "", | |
674 | }, | |
675 | { | |
676 | 'text' => "Special Chars", | |
677 | 'url' => "<hello>&\"you\"/", | |
678 | }, | |
679 | { | |
680 | 'text' => "Non-special", | |
681 | 'url' => "non-special/", | |
682 | }, | |
683 | ], | |
684 | }, | |
685 | ); | |
686 | ||
687 | my @with_skips_nav_menu = | |
688 | ( | |
689 | 'current_host' => "default", | |
690 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
691 | 'tree_contents' => | |
692 | { | |
693 | 'host' => "default", | |
694 | 'text' => "Top 1", | |
695 | 'title' => "T1 Title", | |
696 | 'subs' => | |
697 | [ | |
698 | { | |
699 | 'text' => "Home", | |
700 | 'url' => "", | |
701 | }, | |
702 | { | |
703 | 'text' => "About Me", | |
704 | 'title' => "About Myself", | |
705 | 'url' => "me/", | |
706 | 'expand' => { 're' => "^me/", }, | |
707 | 'subs' => | |
708 | [ | |
709 | { | |
710 | 'text' => "Group Hug", | |
711 | 'url' => "me/group-hug/", | |
712 | }, | |
713 | { | |
714 | 'text' => "Cool I/O", | |
715 | 'url' => "me/cool-io/", | |
716 | }, | |
717 | { | |
718 | 'text' => "Resume", | |
719 | 'url' => "resume.html", | |
720 | }, | |
721 | ], | |
722 | }, | |
723 | { | |
724 | 'text' => "Halifax", | |
725 | 'url' => "halifax/", | |
726 | 'skip' => 1, | |
727 | }, | |
728 | { | |
729 | 'text' => "Software", | |
730 | 'title' => "Open Source Software I Wrote", | |
731 | 'url' => "open-source/", | |
732 | 'expand' => { 're' => "^open-source/", }, | |
733 | 'subs' => | |
734 | [ | |
735 | { | |
736 | 'text' => "Fooware", | |
737 | 'url' => "open-source/fooware/", | |
738 | 'skip' => 1, | |
739 | }, | |
740 | { | |
741 | 'text' => "Condor-Man", | |
742 | 'title' => "Kwalitee", | |
743 | 'url' => "open-source/condor-man/", | |
744 | }, | |
745 | ], | |
746 | }, | |
747 | ], | |
748 | }, | |
749 | ); | |
750 | ||
751 | my @root_path_not_slash = | |
752 | ( | |
753 | 'current_host' => "default", | |
754 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
755 | 'tree_contents' => | |
756 | { | |
757 | 'host' => "default", | |
758 | 'text' => "Top 1", | |
759 | 'title' => "T1 Title", | |
760 | 'subs' => | |
761 | [ | |
762 | { | |
763 | 'text' => "Home", | |
764 | 'url' => "puzzles/", | |
765 | subs => | |
766 | [ | |
767 | { | |
768 | url => "puzzles/foo/", | |
769 | 'text' => "The Foo Puzzle", | |
770 | }, | |
771 | { | |
772 | url => "puzzles/bar/", | |
773 | text => "The Bar Puzzle", | |
774 | }, | |
775 | ], | |
776 | }, | |
777 | { | |
778 | 'text' => "About Me", | |
779 | 'title' => "About Myself", | |
780 | 'url' => "puzzles/me/", | |
781 | }, | |
782 | ], | |
783 | }, | |
784 | ); | |
785 | ||
786 | my @non_capturing_expand = | |
787 | ( | |
788 | 'current_host' => "default", | |
789 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
790 | 'tree_contents' => | |
791 | { | |
792 | 'host' => "default", | |
793 | 'text' => "Top 1", | |
794 | 'title' => "T1 Title", | |
795 | 'subs' => | |
796 | [ | |
797 | { | |
798 | 'text' => "Home", | |
799 | 'url' => "", | |
800 | }, | |
801 | { | |
802 | 'text' => "Humour", | |
803 | 'url' => "humour/", | |
804 | 'expand' => { 're' => "^humour/", }, | |
805 | 'title' => "My Humorous Creations", | |
806 | 'subs' => | |
807 | [ | |
808 | { | |
809 | 'text' => "Stories", | |
810 | 'url' => "humour/stories/", | |
811 | 'title' => "Large-Scale Stories I Wrote", | |
812 | 'expand' => { 're' => "^humour/", capt => 0,}, | |
813 | 'subs' => | |
814 | [ | |
815 | { | |
816 | 'text' => "The Enemy", | |
817 | 'url' => "humour/TheEnemy/", | |
818 | }, | |
819 | { | |
820 | 'text' => "TOW The Fountainhead", | |
821 | 'url' => "humour/TOWTF/", | |
822 | }, | |
823 | ], | |
824 | }, | |
825 | { | |
826 | 'text' => "By Others", | |
827 | 'url' => "humour/by-others/", | |
828 | 'expand' => { 're' => "^humour/by-others/", }, | |
829 | }, | |
830 | ], | |
831 | } | |
832 | ], | |
833 | }, | |
834 | ); | |
835 | ||
836 | ||
837 | my @non_capturing_expand_reversed = | |
838 | ( | |
839 | 'current_host' => "default", | |
840 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
841 | 'tree_contents' => | |
842 | { | |
843 | 'host' => "default", | |
844 | 'text' => "Top 1", | |
845 | 'title' => "T1 Title", | |
846 | 'subs' => | |
847 | [ | |
848 | { | |
849 | 'text' => "Home", | |
850 | 'url' => "", | |
851 | }, | |
852 | { | |
853 | 'text' => "Humour", | |
854 | 'url' => "humour/", | |
855 | 'expand' => { 're' => "^humour/", }, | |
856 | 'title' => "My Humorous Creations", | |
857 | 'subs' => | |
858 | [ | |
859 | { | |
860 | 'text' => "Stories", | |
861 | 'url' => "humour/stories/", | |
862 | 'title' => "Large-Scale Stories I Wrote", | |
863 | 'subs' => | |
864 | [ | |
865 | { | |
866 | 'text' => "The Enemy", | |
867 | 'url' => "humour/TheEnemy/", | |
868 | }, | |
869 | { | |
870 | 'text' => "TOW The Fountainhead", | |
871 | 'url' => "humour/TOWTF/", | |
872 | }, | |
873 | ], | |
874 | }, | |
875 | { | |
876 | 'text' => "By Others", | |
877 | 'url' => "humour/by-others/", | |
878 | 'expand' => { 're' => "^humour/", capt => 0, }, | |
879 | subs => | |
880 | [ | |
881 | { | |
882 | text => "Foo", | |
883 | url => "humour/by-others/foo.html", | |
884 | }, | |
885 | ], | |
886 | }, | |
887 | ], | |
888 | } | |
889 | ], | |
890 | }, | |
891 | ); | |
892 | ||
893 | ||
894 | my @non_capturing_expand_nested = | |
895 | ( | |
896 | 'current_host' => "default", | |
897 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
898 | 'tree_contents' => | |
899 | { | |
900 | 'host' => "default", | |
901 | 'text' => "Top 1", | |
902 | 'title' => "T1 Title", | |
903 | 'subs' => | |
904 | [ | |
905 | { | |
906 | 'text' => "Home", | |
907 | 'url' => "", | |
908 | }, | |
909 | { | |
910 | 'text' => "Humour", | |
911 | 'url' => "humour/", | |
912 | 'expand' => { 're' => "^humour/", }, | |
913 | 'title' => "My Humorous Creations", | |
914 | 'subs' => | |
915 | [ | |
916 | { | |
917 | 'text' => "Stories", | |
918 | 'url' => "humour/stories/", | |
919 | 'expand' => { 're' => "^humour/", 'capt' => 0 }, | |
920 | 'title' => "Large-Scale Stories I Wrote", | |
921 | 'subs' => | |
922 | [ | |
923 | { | |
924 | 'text' => "The Enemy", | |
925 | 'url' => "humour/TheEnemy/", | |
926 | }, | |
927 | { | |
928 | 'text' => "TOW The Fountainhead", | |
929 | 'url' => "humour/TOWTF/", | |
930 | }, | |
931 | ], | |
932 | }, | |
933 | { | |
934 | 'text' => "By Others", | |
935 | 'url' => "humour/by-others/", | |
936 | 'expand' => { 're' => "^humour/", capt => 0, }, | |
937 | subs => | |
938 | [ | |
939 | { | |
940 | text => "Foo", | |
941 | url => "humour/by-others/foo.html", | |
942 | }, | |
943 | ], | |
944 | }, | |
945 | ], | |
946 | } | |
947 | ], | |
948 | }, | |
949 | ); | |
950 | ||
951 | my @header_role_with_empty_cat_nav_menu = | |
952 | ( | |
953 | 'current_host' => "default", | |
954 | 'hosts' => { 'default' => { 'base_url' => "http://www.hello.com/" }, }, | |
955 | 'tree_contents' => | |
956 | { | |
957 | 'host' => "default", | |
958 | 'text' => "Top 1", | |
959 | 'title' => "T1 Title", | |
960 | 'subs' => | |
961 | [ | |
962 | { | |
963 | 'text' => "Home", | |
964 | 'url' => "", | |
965 | }, | |
966 | { | |
967 | 'text' => "Empty Category", | |
968 | 'url' => "empty-cat/", | |
969 | 'role' => "header", | |
970 | 'show_always' => 1, | |
971 | }, | |
972 | { | |
973 | 'text' => "About Me", | |
974 | 'title' => "About Myself", | |
975 | 'url' => "me/", | |
976 | 'role' => "header", | |
977 | 'show_always' => 1, | |
978 | 'subs' => | |
979 | [ | |
980 | { | |
981 | 'text' => "Sub Me", | |
982 | 'url' => "me/sub-me1/", | |
983 | }, | |
984 | { | |
985 | 'text' => "Sub Me 2", | |
986 | 'url' => "me/sub-me-two/", | |
987 | }, | |
988 | ], | |
989 | }, | |
990 | { | |
991 | 'text' => "Hello", | |
992 | 'url' => "aloha/", | |
993 | 'show_always' => 1, | |
994 | 'role' => "notexist", | |
995 | 'subs' => | |
996 | [ | |
997 | { | |
998 | 'text' => "OBKB", | |
999 | 'url' => "aloha/obkb/", | |
1000 | }, | |
1001 | ], | |
1002 | }, | |
1003 | ], | |
1004 | }, | |
1005 | ); | |
1006 | ||
1007 | sub get_test_data | |
1008 | { | |
1009 | return | |
1010 | { | |
1011 | 'two_sites' => \@two_sites_data, | |
1012 | 'minimal' => \@minimal_nav_menu, | |
1013 | 'expand_re' => \@expand_re_nav_menu, | |
1014 | 'show_always' => \@show_always_nav_menu, | |
1015 | 'items_in_sub' => \@items_in_sub_nav_menu, | |
1016 | 'separator' => \@separator_nav_menu, | |
1017 | 'hidden_item' => \@hidden_item_nav_menu, | |
1018 | 'header_role' => \@header_role_nav_menu, | |
1019 | 'selective_expand' => \@selective_expand_nav_menu, | |
1020 | 'url_type_menu' => \@url_type_menu, | |
1021 | 'rec_url_type_menu' => \@rec_url_type_menu, | |
1022 | 'url_is_abs_menu' => \@url_is_abs_nav_menu, | |
1023 | 'mixed_expand_menu' => \@mixed_expand_nav_menu, | |
1024 | 'special_chars_menu' => \@special_chars_nav_menu, | |
1025 | 'with_skips' => \@with_skips_nav_menu, | |
1026 | 'root_path_not_slash' => \@root_path_not_slash, | |
1027 | 'non_capturing_expand' => \@non_capturing_expand, | |
1028 | 'non_capturing_expand_reversed' => \@non_capturing_expand_reversed, | |
1029 | 'non_capturing_expand_nested' => \@non_capturing_expand_nested, | |
1030 | 'header_role_with_empty_cat' => \@header_role_with_empty_cat_nav_menu | |
1031 | }; | |
1032 | } | |
1033 | ||
1034 | 1; |
0 | use strict; | |
1 | use warnings; | |
2 | ||
3 | use IO::Scalar; | |
4 | ||
5 | open SAVEOUT, ">&STDOUT"; | |
6 | print SAVEOUT ""; | |
7 | ||
8 | my $buffer = ""; | |
9 | ||
10 | tie *STDOUT, 'IO::Scalar', \$buffer; | |
11 | ||
12 | sub reset_out_buffer | |
13 | { | |
14 | $buffer = ""; | |
15 | } | |
16 | ||
17 | sub get_out_buffer | |
18 | { | |
19 | return $buffer; | |
20 | } | |
21 | ||
22 | 1; | |
23 |
0 | package HTML::Widgets::NavMenu::Test::Util; | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use Exporter; | |
6 | use vars qw(@ISA); | |
7 | @ISA=qw(Exporter); | |
8 | ||
9 | use vars qw(@EXPORT); | |
10 | ||
11 | @EXPORT = qw(compare_string_arrays); | |
12 | ||
13 | sub compare_string_arrays | |
14 | { | |
15 | my $arr1 = shift; | |
16 | my $arr2 = shift; | |
17 | my $len_cmp = (@$arr1 <=> @$arr2); | |
18 | if ($len_cmp) | |
19 | { | |
20 | print STDERR "Len is not the same: Expected " . scalar(@$arr1) . " vs. Result " . scalar(@$arr2) . "\n"; | |
21 | return $len_cmp; | |
22 | } | |
23 | my $i; | |
24 | for($i=0;$i<@$arr1;$i++) | |
25 | { | |
26 | my $item_cmp = $arr1->[$i] cmp $arr2->[$i]; | |
27 | if ($item_cmp) | |
28 | { | |
29 | print STDERR "Item[$i] is not the same:\nExpected: $arr1->[$i]\nResult: $arr2->[$i]\n"; | |
30 | return $item_cmp; | |
31 | } | |
32 | } | |
33 | return 0; | |
34 | } | |
35 | ||
36 | 1; |