Acme::Spinners

Acme::Spinners is a fully extensible framework...for creating text spinners.
Download

Acme::Spinners Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Noah Rankins
  • Publisher web site:
  • http://search.cpan.org/~kscript/Acme-Spinners-0.6/lib/Acme/Spinners.pm

Acme::Spinners Tags


Acme::Spinners Description

Acme::Spinners is a fully extensible framework...for creating text spinners. Acme::Spinners is a fully extensible framework...for creating text spinners.SYNOPSIS use strict; use warnings; use Acme::Spinners; use Acme::Spinners::Simple; # simple clockwise rotating blade my $spinner = new Acme::Spinners (); $spinner->spinner(new Acme::Spinners::Simple()); $spinner->start(); sleep 5; $spinner->stop(); sleep 1;Ever make a CLI application and needed a way to provide the user that something was going on? Want to do it with style? Need an entire modularized infrastructure to do it?Acme::Spinners is your friend.This module allows you to select from a small array of pre-defined spinners for your enjoyment. Even better, it allows you to make your own spinners for your enjoyment.METHODSnew()new() just makes a new object. Simple enough. Takes no arguments (feel free to supply garbage ones to frighten code readers (we recommend anal => 1, explosive => "true").spinner($spinner)spinner($spinner) sets the spinner you want to use. Takes one argument, a new instance of the spinner you want to use.start()start() startes the fun. When called, the spinner starts. Takes no arguments.THIS FUNCTION RETURNS IMMEDIATELY! If you call start immediately followed by stop, you will be sorely disappointed. This method allows you to return, do you business, and stop the spinner when you're done.stop()stop() stops the spinner. Takes no arguments. See BUGS section for potential problems with this method.APITo create your own spinners, you just need to make a class and add a few methods.REQUIREDnew()A simple bless {}, $_; will suffice. If you need more than that, feel free to add more. Your program will be calling new() to initialize your spinner.frames()This method should return an array of frames for your spinner. If you have a dynamic spinner (see below), just return undef.speed()This method should return how long to wait between each frame switch. If you have a dynamic spinner (see below), this method will be called multiple times.OPTIONALdynamic()Implementing this function (and returning true) indicates that you have a dynamic spinner. Dynamic spinners can change the speed that the spinner spins at between each frame, as well as being able to generate their frames dynamically. See the code of Acme::Spinners::Dynamic for an example.get_next_frame()If you implement dynamic() (above), you must implement this function. This function is called between each spinner frame, and it should return the next spinner in the sequence. Requirements: · Perl


Acme::Spinners Related Software