NAME

Term::YAP - show pulsed progress bar in terminal

SYNOPSIS

    use Term::YAP;
    my $yap = Term::YAP->new( { name => 'Checking', rotate => 0, time => 1 } );
    $yap->start(); # start the pulse
    # do something between
    $yap->stop() # stop it

DESCRIPTION

Term::YAP is a Moo based class to implement a "pulse" bar in a terminal. A pulse bar doesn't actually keep track of progress from any task being executed but at least shows that the program is working in something instead of showing nothing for the end user.

This is the parent class and some methods were not implemented, you probably want to look for subclasses to get an implementation.

This module started as a shamelessly copy from Term::Pulse, nowadays it keeps the same features but with a different implementation.

EXPORT

Nothing.

ATTRIBUTES

All attributes are optional and have their respective default values.

name

A simple message displayed before the pulse. The default value is 'Working'.

rotatable

Boolean. Rotates the pulse if set to true. It is false by default.

time

Boolean. Display the elapsed time if set to 1. Turn off by default.

size

Set the pulse size. The default value is 16.

start_time

The time (Unix Epoch) that the pulse bar started in seconds.

This attribute is "private".

usleep

The microseconds elapsed that each pulse has between each other. The default value is 200000.

This attribute is "private".

running

Boolean. If true, the pulse was started, false otherwise.

output Defines a IO::File object where the output is written. Created to make it easier for testing, specially because the output is designed for better view in a terminal. Defaults to *STDOUT{IO}.

debug

Boolean. If true, additional messages (which will mangle output) will by printed to STDOUT.

Defaults to false.

METHODS

is_running

Getter for running attribute.

BUILD

Install handlers for signals INT and __DIE__.

get_name

Returns the value of the name attribute.

is_rotatable

Returns the value of rotatable attribute.

show_time

Returns the value of time attribute.

get_size

Returns the value of size attribute.

start

Starts the pulse. Returns the value of running attribute.

is_debug

Returns the value set of debug attribute.

set_debug

Setter for the debug attribute.

stop

Stop the pulse and return elapsed time.

SEE ALSO

AUTHOR

Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>

Term::Pulse was originally created by Yen-Liang Chen, <alec at cpan.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 of Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>

This file is part of Term-YAP distribution.

Term-YAP 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 of the License, or (at your option) any later version.

Term-YAP 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 Term-YAP. If not, see <http://www.gnu.org/licenses/>.