| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Goo::OptionIndexTable; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
|
4
|
|
|
|
|
|
|
# Nigel Hamilton |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
|
7
|
|
|
|
|
|
|
# All Rights Reserved |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
|
10
|
|
|
|
|
|
|
# Filename: Goo::OptionIndexTable.pm |
|
11
|
|
|
|
|
|
|
# Description: Take a hash of of options and turn into a table of text |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# Date Change |
|
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
15
|
|
|
|
|
|
|
# 05/10/2005 Auto generated file |
|
16
|
|
|
|
|
|
|
# 05/10/2005 Need to clean up the interfaces and make it simple |
|
17
|
|
|
|
|
|
|
# |
|
18
|
|
|
|
|
|
|
############################################################################### |
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
21
|
1
|
|
|
1
|
|
5
|
use Goo::Prompter; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
34
|
|
|
22
|
1
|
|
|
1
|
|
6
|
use Text::FormatTable; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
365
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
############################################################################### |
|
26
|
|
|
|
|
|
|
# |
|
27
|
|
|
|
|
|
|
# make - constructor |
|
28
|
|
|
|
|
|
|
# |
|
29
|
|
|
|
|
|
|
############################################################################### |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub make { |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
1
|
|
my ($title, $number_of_columns, $index) = @_; |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $table; |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if ($number_of_columns == 4) { |
|
38
|
0
|
|
|
|
|
|
$table = Text::FormatTable->new('4l 20l 4l 20l 4l 20l 4l 20l'); |
|
39
|
0
|
|
|
|
|
|
$table->head('', $title, '', '', '', '', '', ''); |
|
40
|
0
|
|
|
|
|
|
$table->rule('-'); |
|
41
|
|
|
|
|
|
|
} else { |
|
42
|
0
|
|
|
|
|
|
$table = Text::FormatTable->new('4l 100l'); |
|
43
|
0
|
|
|
|
|
|
$table->head('', $title, '', '', '', '', '', ''); |
|
44
|
0
|
|
|
|
|
|
$table->rule('-'); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
my @options = sort { $a cmp $b || $a <=> $b } keys %$index; |
|
|
0
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# how many rows do we need? |
|
50
|
0
|
|
|
|
|
|
my $number_of_rows = scalar(@options) / $number_of_columns; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# is there a remainder? - round it up |
|
53
|
0
|
0
|
|
|
|
|
if ($number_of_rows =~ /(\d+)\./) { |
|
54
|
0
|
|
|
|
|
|
$number_of_rows = $1; |
|
55
|
0
|
|
|
|
|
|
$number_of_rows++; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# add a row at a time |
|
59
|
0
|
|
|
|
|
|
foreach my $row (1 .. $number_of_rows) { |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my @args = (); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# add to each column |
|
64
|
0
|
|
|
|
|
|
foreach my $column (1 .. $number_of_columns) { |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $option = shift(@options); |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
if (defined($option)) { |
|
69
|
0
|
|
|
|
|
|
push(@args, "[$option]"); # add the index |
|
70
|
0
|
|
|
|
|
|
push(@args, $index->{$option}); # add the text |
|
71
|
|
|
|
|
|
|
} else { |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# blank cells |
|
74
|
0
|
|
|
|
|
|
push(@args, ''); |
|
75
|
0
|
|
|
|
|
|
push(@args, ''); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$table->row(@args); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return Goo::Prompter::highlight_options($table->render()); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 NAME |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Goo::OptionIndexTable - Take a hash of options and turn into a table of text |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
use Goo::OptionIndexTable; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 METHODS |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=over |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item make |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
constructor |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=back |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 AUTHOR |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
119
|
|
|
|
|
|
|
|