| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Array::Columnize options processing |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=cut |
|
6
|
|
|
|
|
|
|
package Array::Columnize; |
|
7
|
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
35164
|
use vars qw($DEFAULT_OPTS); |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
2009
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Default values for columize options. |
|
11
|
|
|
|
|
|
|
$DEFAULT_OPTS = { |
|
12
|
|
|
|
|
|
|
arrange_array => 0, |
|
13
|
|
|
|
|
|
|
arrange_vertical => 1, |
|
14
|
|
|
|
|
|
|
array_prefix => '', |
|
15
|
|
|
|
|
|
|
array_suffix => '', |
|
16
|
|
|
|
|
|
|
colfmt => '', |
|
17
|
|
|
|
|
|
|
colsep => ' ', |
|
18
|
|
|
|
|
|
|
displaywidth => $ENV{'COLUMNS'} || 80, |
|
19
|
|
|
|
|
|
|
lineprefix => '', |
|
20
|
|
|
|
|
|
|
linesuffix => "\n", |
|
21
|
|
|
|
|
|
|
ljust => 'auto', |
|
22
|
|
|
|
|
|
|
term_adjust => 0 |
|
23
|
|
|
|
|
|
|
}; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Merge in default configuration options into the passed hash reference. |
|
26
|
|
|
|
|
|
|
# Values already set in the hash are untouched. |
|
27
|
|
|
|
|
|
|
sub merge_config(%) { |
|
28
|
14
|
|
|
14
|
0
|
2388
|
my $config = shift; |
|
29
|
14
|
|
|
|
|
75
|
while (($field, $default_value) = each %$DEFAULT_OPTS) { |
|
30
|
154
|
100
|
|
|
|
756
|
$config->{$field} = $default_value unless defined $config->{$field}; |
|
31
|
|
|
|
|
|
|
}; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
if (__FILE__ eq $0 ) { |
|
35
|
|
|
|
|
|
|
my %config; |
|
36
|
|
|
|
|
|
|
merge_config \%config; |
|
37
|
|
|
|
|
|
|
require Data::Dumper; |
|
38
|
|
|
|
|
|
|
print Data::Dumper::Dumper(\%config), "\n"; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $config = { |
|
41
|
|
|
|
|
|
|
arrange_array => 0, |
|
42
|
|
|
|
|
|
|
term_adjust => 1, |
|
43
|
|
|
|
|
|
|
lineprefix => '...', |
|
44
|
|
|
|
|
|
|
displaywidth => 10, |
|
45
|
|
|
|
|
|
|
bogus => 'yep' |
|
46
|
|
|
|
|
|
|
}; |
|
47
|
|
|
|
|
|
|
print Data::Dumper::Dumper($config), "\n"; |
|
48
|
|
|
|
|
|
|
merge_config $config; |
|
49
|
|
|
|
|
|
|
print Data::Dumper::Dumper($config), "\n"; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |