line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# ABSTRACT: Runs a progress bar when called |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use strict; |
5
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
65
|
|
6
|
2
|
|
|
2
|
|
9
|
|
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
46
|
|
7
|
|
|
|
|
|
|
use Term::Clear (); |
8
|
2
|
|
|
2
|
|
772
|
use Term::ProgressBar 2.00; |
|
2
|
|
|
|
|
719
|
|
|
2
|
|
|
|
|
44
|
|
9
|
2
|
|
|
2
|
|
854
|
use constant MAX => 100_000; |
|
2
|
|
|
|
|
104801
|
|
|
2
|
|
|
|
|
71
|
|
10
|
2
|
|
|
2
|
|
17
|
|
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
403
|
|
11
|
|
|
|
|
|
|
my ($self) = @_; |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
0
|
12
|
my $max = MAX; |
14
|
|
|
|
|
|
|
my $progress = Term::ProgressBar->new( |
15
|
4
|
|
|
|
|
10
|
{ name => 'Grizzly', count => $max, remove => 1, silent => 0, } ); |
16
|
4
|
|
|
|
|
160
|
|
17
|
|
|
|
|
|
|
$progress->minor(0); |
18
|
|
|
|
|
|
|
my $next_update = 0; |
19
|
4
|
|
|
|
|
79339
|
|
20
|
4
|
|
|
|
|
65
|
for ( 0 .. $max ) { |
21
|
|
|
|
|
|
|
my $is_power = 0; |
22
|
4
|
|
|
|
|
20
|
for ( my $i = 0 ; 2**$i <= $_ ; $i++ ) { |
23
|
400004
|
|
|
|
|
447013975
|
$is_power = 1 if 2**$i == $_; |
24
|
400004
|
|
|
|
|
578903
|
} |
25
|
6275784
|
100
|
|
|
|
11051200
|
|
26
|
|
|
|
|
|
|
$next_update = $progress->update($_) if $_ >= $next_update; |
27
|
|
|
|
|
|
|
} |
28
|
400004
|
100
|
|
|
|
577152
|
$progress->update($max) if $max >= $next_update; |
29
|
|
|
|
|
|
|
|
30
|
4
|
50
|
|
|
|
8928376
|
Term::Clear::clear(); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding UTF-8 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Grizzly::Progress::Bar - Runs a progress bar when called |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 VERSION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
version 0.104 |
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) 2022 by Nobunaga. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This is free software, licensed under: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
The MIT (X11) License |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |