File Coverage

blib/lib/Acme/Spinner.pm
Criterion Covered Total %
statement 6 19 31.5
branch n/a
condition 0 3 0.0
subroutine 2 4 50.0
pod 2 2 100.0
total 10 28 35.7


line stmt bran cond sub pod time code
1             package Acme::Spinner;
2              
3 1     1   22026 use warnings;
  1         2  
  1         32  
4 1     1   5 use strict;
  1         2  
  1         277  
5              
6             =head1 NAME
7              
8             Acme::Spinner - A trivial example of one of those activity spinners
9              
10             =head1 VERSION
11              
12             Version 0.03
13              
14             =cut
15              
16             our $VERSION = '0.03';
17              
18              
19             =head1 SYNOPSIS
20              
21             use Acme::Spinner;
22             my $s = Acme::Spinner->new();
23             while(<>) {
24             print STDERR $s->next(), "\r";
25             do_interesting_stuff( with => $_ );
26             }
27              
28             =head1 ABSTRACT
29              
30             This is a simple module that helps manage one of those silly spinning
31             bar things that some programs use when they want you to think they
32             are busy.
33              
34             =head1 DESCRIPTION
35              
36             Some programs take a long time to do some functions. Sometimes
37             people are get confused about what is happening and start pressing
38             buttons in an effort to illicit some response while a program is
39             taking a long time. Strangely enough if the program gives the
40             person using it something to watch while it is busy with other work
41             the person is much more likely to leave the program alone so that
42             can finish its work.
43              
44             =head1 METHODS
45              
46             =head2 new
47              
48             The creator.
49              
50             =cut
51              
52             sub new {
53 0     0 1   my $class = shift;
54 0   0       $class = ref($class) || $class;
55 0           my $self = {};
56 0           $self->{y} = shift;
57 0           $self->{x} = shift;
58 0           $self->{count} = 0;
59 0           $self->{seq} = '|\\-/';
60              
61 0           return bless( $self, $class );
62             }
63              
64             =head2 next
65              
66             Bump the spinner by one and return it.
67              
68             =cut
69              
70             sub next {
71 0     0 1   my $self = shift;
72 0           my $f = $self->{seq};
73 0           my $t = substr( $f, $self->{count} % length($f), 1 );
74 0           $self->{count}++;
75              
76 0           return ($t);
77             }
78              
79             =head1 AUTHOR
80              
81             Chris Fedde, C<< >>
82              
83             =head1 BUGS
84              
85             Please report any bugs or feature requests to
86             C, or through the web interface at
87             L. I will
88             be notified, and then you'll automatically be notified of progress on
89             your bug as I make changes.
90              
91              
92             =head1 SUPPORT
93              
94             You can find documentation for this module with the perldoc command.
95              
96             perldoc Acme::Spinner
97              
98             You can also look for information at:
99              
100             =over 4
101              
102             =item * RT: CPAN's request tracker
103              
104             L
105              
106             =item * AnnoCPAN: Annotated CPAN documentation
107              
108             L
109              
110             =item * CPAN Ratings
111              
112             L
113              
114             =item * Search CPAN
115              
116             L
117              
118             =back
119              
120              
121             =head1 ACKNOWLEDGEMENTS
122              
123              
124             =head1 COPYRIGHT & LICENSE
125              
126             Copyright 2008 Chris Fedde, all rights reserved.
127              
128             This program is free software; you can redistribute it and/or modify it
129             under the same terms as Perl itself.
130              
131             =cut
132              
133             1; # End of Acme::Spinner