line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Grizzly::Progress::Bar; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Runs a progress bar when called |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
16
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
69
|
|
6
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
53
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
887
|
use Term::Clear (); |
|
2
|
|
|
|
|
902
|
|
|
2
|
|
|
|
|
58
|
|
9
|
2
|
|
|
2
|
|
1019
|
use Term::ProgressBar 2.00; |
|
2
|
|
|
|
|
127836
|
|
|
2
|
|
|
|
|
99
|
|
10
|
2
|
|
|
2
|
|
16
|
use constant MAX => 100_000; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
561
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub progressbar { |
13
|
4
|
|
|
4
|
0
|
14
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
|
|
12
|
my $max = MAX; |
16
|
4
|
|
|
|
|
182
|
my $progress = Term::ProgressBar->new( |
17
|
|
|
|
|
|
|
{ name => 'Grizzly', count => $max, remove => 1, silent => 0, } ); |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
|
|
93587
|
$progress->minor(0); |
20
|
4
|
|
|
|
|
87
|
my $next_update = 0; |
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
|
|
16
|
for ( 0 .. $max ) { |
23
|
400004
|
|
|
|
|
549694641
|
my $is_power = 0; |
24
|
400004
|
|
|
|
|
676639
|
for ( my $i = 0 ; 2**$i <= $_ ; $i++ ) { |
25
|
6275784
|
100
|
|
|
|
13287294
|
$is_power = 1 if 2**$i == $_; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
400004
|
100
|
|
|
|
687919
|
$next_update = $progress->update($_) if $_ >= $next_update; |
29
|
|
|
|
|
|
|
} |
30
|
4
|
50
|
|
|
|
11324464
|
$progress->update($max) if $max >= $next_update; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
Term::Clear::clear(); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding UTF-8 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Grizzly::Progress::Bar - Runs a progress bar when called |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 VERSION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
version 0.103 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Outputs a progress bar so the user can visually see Grizzly gather the stock information. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Grizzly::Progress::Bar |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 AUTHOR |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Nobunaga <nobunaga@cpan.org> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Nobunaga. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
MIT License |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Nobunaga <nobunaga@cpan.org> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This software is Copyright (c) 2021 by Nobunaga. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This is free software, licensed under: |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
The MIT (X11) License |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |