line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Format an Array as an Array of String aligned in columns. |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# == Summary |
4
|
|
|
|
|
|
|
# Format a list into a single string with embedded newlines. |
5
|
|
|
|
|
|
|
# On printing the string the columns are aligned. |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# See documentation for Columnize.columnize below. |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# == License |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Columnize is copyright (C) 2011-2013 Rocky Bernstein |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# All rights reserved. You can redistribute and/or modify it under |
14
|
|
|
|
|
|
|
# the same terms as Perl. |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# Adapted from the routine of the same name in Ruby. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Array::Columnize; |
19
|
1
|
|
|
1
|
|
27287
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
20
|
1
|
|
|
1
|
|
4
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
21
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
22
|
1
|
|
|
1
|
|
4
|
use lib '..'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
554
|
use Array::Columnize::columnize; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
43
|
|
25
|
1
|
|
|
1
|
|
15
|
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
160
|
|
26
|
|
|
|
|
|
|
@ISA = qw/ Exporter /; |
27
|
|
|
|
|
|
|
@EXPORT = qw(columnize); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Add or remove _01 when we want testing. |
30
|
1
|
|
|
1
|
|
1311
|
use version; $VERSION = '1.04'; |
|
1
|
|
|
|
|
2794
|
|
|
1
|
|
|
|
|
12
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
unless (caller) { |
33
|
|
|
|
|
|
|
# Demo code |
34
|
|
|
|
|
|
|
print "This is version: $Array::Columnize::VERSION\n"; |
35
|
|
|
|
|
|
|
print columnize([1,2,3,4], {displaywidth=>4}), "\n"; |
36
|
|
|
|
|
|
|
my $data_ref = [80..120]; |
37
|
|
|
|
|
|
|
print columnize($data_ref, {ljust => 0}) ; |
38
|
|
|
|
|
|
|
print columnize($data_ref, {ljust => 0, arrange_vertical => 0}) ; |
39
|
|
|
|
|
|
|
my @ary = qw(bibrons golden madascar leopard mourning suras tokay); |
40
|
|
|
|
|
|
|
print columnize(\@ary, {displaywidth => 18}); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
'Just another Perl module'; |
44
|
|
|
|
|
|
|
__END__ |