Skip to content

Commit b34ed2d

Browse files
author
Stefan Suciu
committed
Add print_by_row method.
1 parent 6b2d7c9 commit b34ed2d

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

lib/App/PlannedCopy/Ls.pm

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,23 @@ sub column_printer {
119119
}
120120
}
121121

122-
# Print by row
123-
my $col_idx = $self->column_count - 1;
124-
my $row_idx = scalar @{$items_in_cols->[0]} - 1;
122+
$self->print_by_row($items_in_cols);
123+
124+
return;
125+
}
125126

126-
my $templ = $self->build_printf_template($items_in_cols, $col_idx);
127+
sub print_by_row {
128+
my ( $self, $items_in_cols ) = @_;
129+
my $col_idx = $self->column_count - 1;
130+
my $row_idx = scalar @{ $items_in_cols->[0] } - 1;
131+
my $templ = $self->build_printf_template( $items_in_cols, $col_idx );
127132
for my $r ( 0 .. $row_idx ) {
128133
my @row = ();
129134
for my $c ( 0 .. $col_idx ) {
130135
push @row, $items_in_cols->[$c][$r] // '';
131136
}
132137
printf "$templ\n", @row;
133138
}
134-
135139
return;
136140
}
137141

0 commit comments

Comments
 (0)