NAME

PortageXS::UI::Spinner - Dancing Console progress spinner bling.

VERSION

version 0.3.1

SYNOPSIS

use PortageXS::UI::Spinner;

my $spinner = PortageXS::UI::Spinner->new(%attributes);

for ( 0..1000 ){
    sleep 0.1;
    $spinner->spin;
}
$spinner->reset;

METHODS

spin

Emits a backspace and the next spin character to output_handle

reset

Emits a spin-character clearing sequence to output_handle

This is just

\b : backspace over last character
\s : print a space to erase past characters
\b : backspace again to prepare for more output

ATTRIBUTES

spinstate

The index of the next spin state to dispatch.

output_handle

The filehandle to write spin and reset output to.

Defaults to *STDOUT.

Note: Turns on autoflush for *STDOUT if no handle is passed explicitly.

spinstates

The array of spinstates to dispatch

Defaults to:

qw(
    /
    -
    \
    |
)

PRIVATE METHODS

_last_spinstate

The number of spinstates this ::Spinner object has.

_increment_spinstate

Increment the position within the spinstates array by one, updating spinstate

_get_next_spinstate

Returns the next character from the spinstates array

_print_to_output

Internal wrapper to proxy print to output_handle

AUTHORS

  • Christian Hartmann <ian@gentoo.org>

  • Torsten Veller <tove@gentoo.org>

  • Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by Christian Hartmann.

This is free software, licensed under:

The GNU General Public License, Version 2, June 1991