NAME

ProgressMonitor::Stringify::ToEscStatus - monitor printing in EscStatus form

SYNOPSIS

use PerlIO::via::EscStatus;
binmode (STDOUT, ':via(EscStatus)') or die;

use ProgressMonitor::Stringify::ToEscStatus;
my $mon = ProgressMonitor::Stringify::ToEscStatus->new
  ({ fields => [
       ProgressMonitor::Stringify::Fields::Spinner->new
  ]});

$mon->prepare;
$mon->begin;
$mon->tick; $mon->tick; # etc
$mon->end;

CLASS HIERARCHY

ToEscStatus is a subclass of AbstractMonitor,

ProgressMonitor
  ProgressMonitor::AbstractStatefulMonitor
    ProgressMonitor::Stringify::AbstractMonitor
      ProgressMonitor::Stringify::ToEscStatus

DESCRIPTION

ToEscStatus implements a ProgressMonitor which prints status lines in EscStatus form, ready to be shown by an EscStatus layer on the output stream.

Basically where ProgressMonitor::Stringify::ToStream would do something like print "\rStatus line", the ToEscStatus instead does

print make_status("Status line")

giving the output form EscStatus uses. The contents of the status line are built by the configured ProgressMonitor field objects in the usual way. See examples/progressmonitor.pl for a complete program.

FUNCTIONS

ProgressMonitor::Stringify::ToEscStatus->new({key=>value,...})

Create and return a new ToEscStatus progress monitor object. Configuration parameters are taken in usual Moose style as a single hashref argument. This will normally at least include a fields array of objects to do the rendering.

See ProgressMonitor::Stringify::AbstractMonitor for the base configuration parameters. ToEscStatus has the following additional parameters

stream (default STDOUT)

A file handle to write to. The default is standard output, ie. \*STDOUT (the same as ProgressMonitor::Stringify::ToStream).

ToEscStatus doesn't check what layers are on the stream. If for instance you're printing to tty then it's your responsibility to push a PerlIO::via::EscStatus. Similarly it's your responsibility to set :utf8 mode or not, as desired.

SEE ALSO

ProgressMonitor, PerlIO::via::EscStatus, Moose

HOME PAGE

http://user42.tuxfamily.org/perlio-via-escstatus/index.html

LICENSE

Copyright 2008, 2009, 2010, 2011, 2012, 2017 Kevin Ryde

PerlIO-via-EscStatus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

PerlIO-via-EscStatus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with PerlIO-via-EscStatus. If not, see http://www.gnu.org/licenses/.