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