NAME
Term::Output::List - output an updateable list of ongoing jobs
SYNOPSIS
my $printer = Term::Output::List->new(
hook_warnings => 1,
ellipsis => "\N{HORIZONTAL ELLIPSIS}",
);
my @ongoing_tasks = ('file1: frobnicating', 'file2: bamboozling', 'file3: frobnicating');
$printer->output_list(@ongoing_tasks);
$printer->output_permanent("Frobnicated gizmos"); # appears above the list
METHODS
Term::Output::List->new()
fh
-
Filehandle used for output. Default is
STDOUT
. interactive
-
Whether the script is run interactively and should output intermittent updateable information
hook_warnings
-
Install a hook for sending warnings to
->output_permanent
. This prevents ugly tearing/overwriting when your code outputs warnings.
->scroll_up
Helper method to place the cursor at the top of the updateable list.
->output_permanent
$o->output_permanent("Frobnicated 3 items for job 2");
$o->output_list("Frobnicating 9 items for job 1",
"Frobnicating 2 items for job 3",
);
$o->output_permanent("Frobnicated 3 items for job 2");
Outputs items that should go on the permanent record. It is expected to output the (remaining) list of ongoing jobs after that.
->output_list @items
$o->output_list("Frobnicating 9 items for job 1",
"Frobnicating 2 items for job 3",
);
Outputs items that can be updated later, as long as no intervening output (like from print
, say
or warn
) has happened. If you want to output lines that should not be overwritten later, see </-
output_permanent>>
->fresh_output
$o->fresh_output();
Helper subroutine to make all items from the last output list remain as is.
For compatibility between output to a terminal and output without a terminal, you should use ->output_permanent
for things that should be permanent instead.