| 1 | package Term::ProgressSpinner; | ||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | our $VERSION = '1.00'; | |||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use 5.006; use strict; use warnings; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use IO::Handle; use Term::ANSIColor; use Time::HiRes qw//; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Term::Size::Any qw/chars/; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | if ($^O eq 'MSWin32') { eval "use Win32::Console::ANSI; use Win32::Console;"; } | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | our (%SPINNERS, %PROGRESS, %VALIDATE); | |||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||
| 9 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
| 10 | %VALIDATE = ( | ||||||||||||||||||||||||||||||||||||||||
| 11 | colours => { | ||||||||||||||||||||||||||||||||||||||||
| 12 | map { | ||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | my $c = $_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 14 | ( | ||||||||||||||||||||||||||||||||||||||||
| 15 | $c => 1, | ||||||||||||||||||||||||||||||||||||||||
| 16 | "bright_${c}" => 1, | ||||||||||||||||||||||||||||||||||||||||
| 17 | 24 | (map { ( | |||||||||||||||||||||||||||||||||||||||
| 18 | 192 | "${c} on_${_}" => 1, | |||||||||||||||||||||||||||||||||||||||
| 19 | "${c} on_bright_${_}" => 1, | ||||||||||||||||||||||||||||||||||||||||
| 20 | "bright_${c} on_${_}" => 1, | ||||||||||||||||||||||||||||||||||||||||
| 21 | "bright_${c} on_bright_${_}" => 1, | ||||||||||||||||||||||||||||||||||||||||
| 22 | ) } qw/black red green yellow blue magenta cyan white/) | ||||||||||||||||||||||||||||||||||||||||
| 23 | ) | ||||||||||||||||||||||||||||||||||||||||
| 24 | } qw/black red green yellow blue magenta cyan white/ | ||||||||||||||||||||||||||||||||||||||||
| 25 | }, | ||||||||||||||||||||||||||||||||||||||||
| 26 | msg_regex => qr/\{(total|progress|spinner|percents|percentage|percentages|percent|counter|elapsed|elapsed_second|estimate|estimate_second|start_epoch|start_epoch_second|epoch|epoch_second|per_second|last_advance_epoch|last_advance_epoch_second|last_elapsed|last_elapsed_second|elapsed|elapsed_second)\}/ | ||||||||||||||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | %SPINNERS = ( | |||||||||||||||||||||||||||||||||||||||
| 29 | bar => { | ||||||||||||||||||||||||||||||||||||||||
| 30 | width => 3, | ||||||||||||||||||||||||||||||||||||||||
| 31 | index => [4, 2, 6], | ||||||||||||||||||||||||||||||||||||||||
| 32 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 33 | "▁", | ||||||||||||||||||||||||||||||||||||||||
| 34 | "▂", | ||||||||||||||||||||||||||||||||||||||||
| 35 | "▃", | ||||||||||||||||||||||||||||||||||||||||
| 36 | "▄", | ||||||||||||||||||||||||||||||||||||||||
| 37 | "▅", | ||||||||||||||||||||||||||||||||||||||||
| 38 | "▆", | ||||||||||||||||||||||||||||||||||||||||
| 39 | "▇", | ||||||||||||||||||||||||||||||||||||||||
| 40 | "█" | ||||||||||||||||||||||||||||||||||||||||
| 41 | ] | ||||||||||||||||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||||||||||||||
| 43 | dots => { | ||||||||||||||||||||||||||||||||||||||||
| 44 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 45 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 46 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 47 | "⠋", | ||||||||||||||||||||||||||||||||||||||||
| 48 | "⠙", | ||||||||||||||||||||||||||||||||||||||||
| 49 | "⠹", | ||||||||||||||||||||||||||||||||||||||||
| 50 | "⠸", | ||||||||||||||||||||||||||||||||||||||||
| 51 | "⠼", | ||||||||||||||||||||||||||||||||||||||||
| 52 | "⠴", | ||||||||||||||||||||||||||||||||||||||||
| 53 | "⠦", | ||||||||||||||||||||||||||||||||||||||||
| 54 | "⠧", | ||||||||||||||||||||||||||||||||||||||||
| 55 | "⠇", | ||||||||||||||||||||||||||||||||||||||||
| 56 | "⠏" | ||||||||||||||||||||||||||||||||||||||||
| 57 | ] | ||||||||||||||||||||||||||||||||||||||||
| 58 | }, | ||||||||||||||||||||||||||||||||||||||||
| 59 | around => { | ||||||||||||||||||||||||||||||||||||||||
| 60 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 61 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 62 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 63 | "⢀⠀", | ||||||||||||||||||||||||||||||||||||||||
| 64 | "⡀⠀", | ||||||||||||||||||||||||||||||||||||||||
| 65 | "⠄⠀", | ||||||||||||||||||||||||||||||||||||||||
| 66 | "⢂⠀", | ||||||||||||||||||||||||||||||||||||||||
| 67 | "⡂⠀", | ||||||||||||||||||||||||||||||||||||||||
| 68 | "⠅⠀", | ||||||||||||||||||||||||||||||||||||||||
| 69 | "⢃⠀", | ||||||||||||||||||||||||||||||||||||||||
| 70 | "⡃⠀", | ||||||||||||||||||||||||||||||||||||||||
| 71 | "⠍⠀", | ||||||||||||||||||||||||||||||||||||||||
| 72 | "⢋⠀", | ||||||||||||||||||||||||||||||||||||||||
| 73 | "⡋⠀", | ||||||||||||||||||||||||||||||||||||||||
| 74 | "⠍⠁", | ||||||||||||||||||||||||||||||||||||||||
| 75 | "⢋⠁", | ||||||||||||||||||||||||||||||||||||||||
| 76 | "⡋⠁", | ||||||||||||||||||||||||||||||||||||||||
| 77 | "⠍⠉", | ||||||||||||||||||||||||||||||||||||||||
| 78 | "⠋⠉", | ||||||||||||||||||||||||||||||||||||||||
| 79 | "⠋⠉", | ||||||||||||||||||||||||||||||||||||||||
| 80 | "⠉⠙", | ||||||||||||||||||||||||||||||||||||||||
| 81 | "⠉⠙", | ||||||||||||||||||||||||||||||||||||||||
| 82 | "⠉⠩", | ||||||||||||||||||||||||||||||||||||||||
| 83 | "⠈⢙", | ||||||||||||||||||||||||||||||||||||||||
| 84 | "⠈⡙", | ||||||||||||||||||||||||||||||||||||||||
| 85 | "⢈⠩", | ||||||||||||||||||||||||||||||||||||||||
| 86 | "⡀⢙", | ||||||||||||||||||||||||||||||||||||||||
| 87 | "⠄⡙", | ||||||||||||||||||||||||||||||||||||||||
| 88 | "⢂⠩", | ||||||||||||||||||||||||||||||||||||||||
| 89 | "⡂⢘", | ||||||||||||||||||||||||||||||||||||||||
| 90 | "⠅⡘", | ||||||||||||||||||||||||||||||||||||||||
| 91 | "⢃⠨", | ||||||||||||||||||||||||||||||||||||||||
| 92 | "⡃⢐", | ||||||||||||||||||||||||||||||||||||||||
| 93 | "⠍⡐", | ||||||||||||||||||||||||||||||||||||||||
| 94 | "⢋⠠", | ||||||||||||||||||||||||||||||||||||||||
| 95 | "⡋⢀", | ||||||||||||||||||||||||||||||||||||||||
| 96 | "⠍⡁", | ||||||||||||||||||||||||||||||||||||||||
| 97 | "⢋⠁", | ||||||||||||||||||||||||||||||||||||||||
| 98 | "⡋⠁", | ||||||||||||||||||||||||||||||||||||||||
| 99 | "⠍⠉", | ||||||||||||||||||||||||||||||||||||||||
| 100 | "⠋⠉", | ||||||||||||||||||||||||||||||||||||||||
| 101 | "⠋⠉", | ||||||||||||||||||||||||||||||||||||||||
| 102 | "⠉⠙", | ||||||||||||||||||||||||||||||||||||||||
| 103 | "⠉⠙", | ||||||||||||||||||||||||||||||||||||||||
| 104 | "⠉⠩", | ||||||||||||||||||||||||||||||||||||||||
| 105 | "⠈⢙", | ||||||||||||||||||||||||||||||||||||||||
| 106 | "⠈⡙", | ||||||||||||||||||||||||||||||||||||||||
| 107 | "⠈⠩", | ||||||||||||||||||||||||||||||||||||||||
| 108 | "⠀⢙", | ||||||||||||||||||||||||||||||||||||||||
| 109 | "⠀⡙", | ||||||||||||||||||||||||||||||||||||||||
| 110 | "⠀⠩", | ||||||||||||||||||||||||||||||||||||||||
| 111 | "⠀⢘", | ||||||||||||||||||||||||||||||||||||||||
| 112 | "⠀⡘", | ||||||||||||||||||||||||||||||||||||||||
| 113 | "⠀⠨", | ||||||||||||||||||||||||||||||||||||||||
| 114 | "⠀⢐", | ||||||||||||||||||||||||||||||||||||||||
| 115 | "⠀⡐", | ||||||||||||||||||||||||||||||||||||||||
| 116 | "⠀⠠", | ||||||||||||||||||||||||||||||||||||||||
| 117 | "⠀⢀", | ||||||||||||||||||||||||||||||||||||||||
| 118 | "⠀⡀" | ||||||||||||||||||||||||||||||||||||||||
| 119 | ] | ||||||||||||||||||||||||||||||||||||||||
| 120 | }, | ||||||||||||||||||||||||||||||||||||||||
| 121 | pipe => { | ||||||||||||||||||||||||||||||||||||||||
| 122 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 123 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 124 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 125 | "┤", | ||||||||||||||||||||||||||||||||||||||||
| 126 | "┘", | ||||||||||||||||||||||||||||||||||||||||
| 127 | "┴", | ||||||||||||||||||||||||||||||||||||||||
| 128 | "└", | ||||||||||||||||||||||||||||||||||||||||
| 129 | "├", | ||||||||||||||||||||||||||||||||||||||||
| 130 | "┌", | ||||||||||||||||||||||||||||||||||||||||
| 131 | "┬", | ||||||||||||||||||||||||||||||||||||||||
| 132 | "┐" | ||||||||||||||||||||||||||||||||||||||||
| 133 | ] | ||||||||||||||||||||||||||||||||||||||||
| 134 | }, | ||||||||||||||||||||||||||||||||||||||||
| 135 | moon => { | ||||||||||||||||||||||||||||||||||||||||
| 136 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 137 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 138 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 139 | "🌑 ", | ||||||||||||||||||||||||||||||||||||||||
| 140 | "🌒 ", | ||||||||||||||||||||||||||||||||||||||||
| 141 | "🌓 ", | ||||||||||||||||||||||||||||||||||||||||
| 142 | "🌔 ", | ||||||||||||||||||||||||||||||||||||||||
| 143 | "🌕 ", | ||||||||||||||||||||||||||||||||||||||||
| 144 | "🌖 ", | ||||||||||||||||||||||||||||||||||||||||
| 145 | "🌗 ", | ||||||||||||||||||||||||||||||||||||||||
| 146 | "🌘 " | ||||||||||||||||||||||||||||||||||||||||
| 147 | ] | ||||||||||||||||||||||||||||||||||||||||
| 148 | }, | ||||||||||||||||||||||||||||||||||||||||
| 149 | circle => { | ||||||||||||||||||||||||||||||||||||||||
| 150 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 151 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 152 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 153 | "・", | ||||||||||||||||||||||||||||||||||||||||
| 154 | "◦", | ||||||||||||||||||||||||||||||||||||||||
| 155 | "●", | ||||||||||||||||||||||||||||||||||||||||
| 156 | "○", | ||||||||||||||||||||||||||||||||||||||||
| 157 | "◎", | ||||||||||||||||||||||||||||||||||||||||
| 158 | "◉", | ||||||||||||||||||||||||||||||||||||||||
| 159 | "⦿", | ||||||||||||||||||||||||||||||||||||||||
| 160 | "◉", | ||||||||||||||||||||||||||||||||||||||||
| 161 | "◎", | ||||||||||||||||||||||||||||||||||||||||
| 162 | "○", | ||||||||||||||||||||||||||||||||||||||||
| 163 | "◦", | ||||||||||||||||||||||||||||||||||||||||
| 164 | "・", | ||||||||||||||||||||||||||||||||||||||||
| 165 | ] | ||||||||||||||||||||||||||||||||||||||||
| 166 | }, | ||||||||||||||||||||||||||||||||||||||||
| 167 | color_circle => { | ||||||||||||||||||||||||||||||||||||||||
| 168 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 169 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 170 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 171 | "🔴", | ||||||||||||||||||||||||||||||||||||||||
| 172 | "🟠", | ||||||||||||||||||||||||||||||||||||||||
| 173 | "🟡", | ||||||||||||||||||||||||||||||||||||||||
| 174 | "🟢", | ||||||||||||||||||||||||||||||||||||||||
| 175 | "🔵", | ||||||||||||||||||||||||||||||||||||||||
| 176 | "🟣", | ||||||||||||||||||||||||||||||||||||||||
| 177 | "⚫️", | ||||||||||||||||||||||||||||||||||||||||
| 178 | "⚪️", | ||||||||||||||||||||||||||||||||||||||||
| 179 | "🟤" | ||||||||||||||||||||||||||||||||||||||||
| 180 | ] | ||||||||||||||||||||||||||||||||||||||||
| 181 | }, | ||||||||||||||||||||||||||||||||||||||||
| 182 | color_circles => { | ||||||||||||||||||||||||||||||||||||||||
| 183 | width => 3, | ||||||||||||||||||||||||||||||||||||||||
| 184 | index => [1, 4, 7], | ||||||||||||||||||||||||||||||||||||||||
| 185 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 186 | "🔴", | ||||||||||||||||||||||||||||||||||||||||
| 187 | "🟠", | ||||||||||||||||||||||||||||||||||||||||
| 188 | "🟡", | ||||||||||||||||||||||||||||||||||||||||
| 189 | "🟢", | ||||||||||||||||||||||||||||||||||||||||
| 190 | "🔵", | ||||||||||||||||||||||||||||||||||||||||
| 191 | "🟣", | ||||||||||||||||||||||||||||||||||||||||
| 192 | "⚫️", | ||||||||||||||||||||||||||||||||||||||||
| 193 | "⚪️", | ||||||||||||||||||||||||||||||||||||||||
| 194 | "🟤" | ||||||||||||||||||||||||||||||||||||||||
| 195 | ] | ||||||||||||||||||||||||||||||||||||||||
| 196 | }, | ||||||||||||||||||||||||||||||||||||||||
| 197 | color_square => { | ||||||||||||||||||||||||||||||||||||||||
| 198 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 199 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 200 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 201 | "🟥", | ||||||||||||||||||||||||||||||||||||||||
| 202 | "🟧", | ||||||||||||||||||||||||||||||||||||||||
| 203 | "🟨", | ||||||||||||||||||||||||||||||||||||||||
| 204 | "🟩", | ||||||||||||||||||||||||||||||||||||||||
| 205 | "🟦", | ||||||||||||||||||||||||||||||||||||||||
| 206 | "🟪", | ||||||||||||||||||||||||||||||||||||||||
| 207 | "⬛️", | ||||||||||||||||||||||||||||||||||||||||
| 208 | "⬜️", | ||||||||||||||||||||||||||||||||||||||||
| 209 | "🟫" | ||||||||||||||||||||||||||||||||||||||||
| 210 | ] | ||||||||||||||||||||||||||||||||||||||||
| 211 | }, | ||||||||||||||||||||||||||||||||||||||||
| 212 | color_squares => { | ||||||||||||||||||||||||||||||||||||||||
| 213 | width => 3, | ||||||||||||||||||||||||||||||||||||||||
| 214 | index => [1, 3, 6], | ||||||||||||||||||||||||||||||||||||||||
| 215 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 216 | "🟥", | ||||||||||||||||||||||||||||||||||||||||
| 217 | "🟧", | ||||||||||||||||||||||||||||||||||||||||
| 218 | "🟨", | ||||||||||||||||||||||||||||||||||||||||
| 219 | "🟩", | ||||||||||||||||||||||||||||||||||||||||
| 220 | "🟦", | ||||||||||||||||||||||||||||||||||||||||
| 221 | "🟪", | ||||||||||||||||||||||||||||||||||||||||
| 222 | "⬛️", | ||||||||||||||||||||||||||||||||||||||||
| 223 | "⬜️", | ||||||||||||||||||||||||||||||||||||||||
| 224 | "🟫" | ||||||||||||||||||||||||||||||||||||||||
| 225 | ] | ||||||||||||||||||||||||||||||||||||||||
| 226 | }, | ||||||||||||||||||||||||||||||||||||||||
| 227 | earth => { | ||||||||||||||||||||||||||||||||||||||||
| 228 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 229 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 230 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 231 | "🌎", | ||||||||||||||||||||||||||||||||||||||||
| 232 | "🌍", | ||||||||||||||||||||||||||||||||||||||||
| 233 | "🌏" | ||||||||||||||||||||||||||||||||||||||||
| 234 | ] | ||||||||||||||||||||||||||||||||||||||||
| 235 | }, | ||||||||||||||||||||||||||||||||||||||||
| 236 | circle_half => { | ||||||||||||||||||||||||||||||||||||||||
| 237 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 238 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 239 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 240 | '◐', | ||||||||||||||||||||||||||||||||||||||||
| 241 | '◓', | ||||||||||||||||||||||||||||||||||||||||
| 242 | '◑', | ||||||||||||||||||||||||||||||||||||||||
| 243 | '◒' | ||||||||||||||||||||||||||||||||||||||||
| 244 | ] | ||||||||||||||||||||||||||||||||||||||||
| 245 | }, | ||||||||||||||||||||||||||||||||||||||||
| 246 | clock => { | ||||||||||||||||||||||||||||||||||||||||
| 247 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 248 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 249 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 250 | "🕛 ", | ||||||||||||||||||||||||||||||||||||||||
| 251 | "🕐 ", | ||||||||||||||||||||||||||||||||||||||||
| 252 | "🕑 ", | ||||||||||||||||||||||||||||||||||||||||
| 253 | "🕒 ", | ||||||||||||||||||||||||||||||||||||||||
| 254 | "🕓 ", | ||||||||||||||||||||||||||||||||||||||||
| 255 | "🕔 ", | ||||||||||||||||||||||||||||||||||||||||
| 256 | "🕕 ", | ||||||||||||||||||||||||||||||||||||||||
| 257 | "🕖 ", | ||||||||||||||||||||||||||||||||||||||||
| 258 | "🕗 ", | ||||||||||||||||||||||||||||||||||||||||
| 259 | "🕘 ", | ||||||||||||||||||||||||||||||||||||||||
| 260 | "🕙 ", | ||||||||||||||||||||||||||||||||||||||||
| 261 | "🕚 " | ||||||||||||||||||||||||||||||||||||||||
| 262 | ] | ||||||||||||||||||||||||||||||||||||||||
| 263 | }, | ||||||||||||||||||||||||||||||||||||||||
| 264 | pong => { | ||||||||||||||||||||||||||||||||||||||||
| 265 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 266 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 267 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 268 | "▐⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 269 | "▐⠈ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 270 | "▐ ⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 271 | "▐ ⠠ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 272 | "▐ ⡀ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 273 | "▐ ⠠ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 274 | "▐ ⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 275 | "▐ ⠈ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 276 | "▐ ⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 277 | "▐ ⠠ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 278 | "▐ ⡀ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 279 | "▐ ⠠ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 280 | "▐ ⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 281 | "▐ ⠈ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 282 | "▐ ⠂▌", | ||||||||||||||||||||||||||||||||||||||||
| 283 | "▐ ⠠▌", | ||||||||||||||||||||||||||||||||||||||||
| 284 | "▐ ⡀▌", | ||||||||||||||||||||||||||||||||||||||||
| 285 | "▐ ⠠ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 286 | "▐ ⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 287 | "▐ ⠈ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 288 | "▐ ⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 289 | "▐ ⠠ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 290 | "▐ ⡀ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 291 | "▐ ⠠ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 292 | "▐ ⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 293 | "▐ ⠈ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 294 | "▐ ⠂ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 295 | "▐ ⠠ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 296 | "▐ ⡀ ▌", | ||||||||||||||||||||||||||||||||||||||||
| 297 | "▐⠠ ▌" | ||||||||||||||||||||||||||||||||||||||||
| 298 | ] | ||||||||||||||||||||||||||||||||||||||||
| 299 | }, | ||||||||||||||||||||||||||||||||||||||||
| 300 | material => { | ||||||||||||||||||||||||||||||||||||||||
| 301 | width => 1, | ||||||||||||||||||||||||||||||||||||||||
| 302 | index => [1], | ||||||||||||||||||||||||||||||||||||||||
| 303 | chars => [ | ||||||||||||||||||||||||||||||||||||||||
| 304 | "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 305 | "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 306 | "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 307 | "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 308 | "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 309 | "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 310 | "███████▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 311 | "████████▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 312 | "█████████▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 313 | "█████████▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 314 | "██████████▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 315 | "███████████▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 316 | "█████████████▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 317 | "██████████████▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 318 | "██████████████▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 319 | "▁██████████████▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 320 | "▁██████████████▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 321 | "▁██████████████▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 322 | "▁▁██████████████▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 323 | "▁▁▁██████████████▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 324 | "▁▁▁▁█████████████▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 325 | "▁▁▁▁██████████████▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 326 | "▁▁▁▁██████████████▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 327 | "▁▁▁▁▁██████████████▁", | ||||||||||||||||||||||||||||||||||||||||
| 328 | "▁▁▁▁▁██████████████▁", | ||||||||||||||||||||||||||||||||||||||||
| 329 | "▁▁▁▁▁██████████████▁", | ||||||||||||||||||||||||||||||||||||||||
| 330 | "▁▁▁▁▁▁██████████████", | ||||||||||||||||||||||||||||||||||||||||
| 331 | "▁▁▁▁▁▁██████████████", | ||||||||||||||||||||||||||||||||||||||||
| 332 | "▁▁▁▁▁▁▁█████████████", | ||||||||||||||||||||||||||||||||||||||||
| 333 | "▁▁▁▁▁▁▁█████████████", | ||||||||||||||||||||||||||||||||||||||||
| 334 | "▁▁▁▁▁▁▁▁████████████", | ||||||||||||||||||||||||||||||||||||||||
| 335 | "▁▁▁▁▁▁▁▁████████████", | ||||||||||||||||||||||||||||||||||||||||
| 336 | "▁▁▁▁▁▁▁▁▁███████████", | ||||||||||||||||||||||||||||||||||||||||
| 337 | "▁▁▁▁▁▁▁▁▁███████████", | ||||||||||||||||||||||||||||||||||||||||
| 338 | "▁▁▁▁▁▁▁▁▁▁██████████", | ||||||||||||||||||||||||||||||||||||||||
| 339 | "▁▁▁▁▁▁▁▁▁▁██████████", | ||||||||||||||||||||||||||||||||||||||||
| 340 | "▁▁▁▁▁▁▁▁▁▁▁▁████████", | ||||||||||||||||||||||||||||||||||||||||
| 341 | "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", | ||||||||||||||||||||||||||||||||||||||||
| 342 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████", | ||||||||||||||||||||||||||||||||||||||||
| 343 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", | ||||||||||||||||||||||||||||||||||||||||
| 344 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", | ||||||||||||||||||||||||||||||||||||||||
| 345 | "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", | ||||||||||||||||||||||||||||||||||||||||
| 346 | "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", | ||||||||||||||||||||||||||||||||||||||||
| 347 | "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", | ||||||||||||||||||||||||||||||||||||||||
| 348 | "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", | ||||||||||||||||||||||||||||||||||||||||
| 349 | "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", | ||||||||||||||||||||||||||||||||||||||||
| 350 | "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", | ||||||||||||||||||||||||||||||||||||||||
| 351 | "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", | ||||||||||||||||||||||||||||||||||||||||
| 352 | "██████▁▁▁▁▁▁▁▁▁▁▁▁▁█", | ||||||||||||||||||||||||||||||||||||||||
| 353 | "████████▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 354 | "█████████▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 355 | "█████████▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 356 | "█████████▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 357 | "█████████▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 358 | "███████████▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 359 | "████████████▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 360 | "████████████▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 361 | "██████████████▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 362 | "██████████████▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 363 | "▁██████████████▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 364 | "▁██████████████▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 365 | "▁▁▁█████████████▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 366 | "▁▁▁▁▁████████████▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 367 | "▁▁▁▁▁████████████▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 368 | "▁▁▁▁▁▁███████████▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 369 | "▁▁▁▁▁▁▁▁█████████▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 370 | "▁▁▁▁▁▁▁▁█████████▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 371 | "▁▁▁▁▁▁▁▁▁█████████▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 372 | "▁▁▁▁▁▁▁▁▁█████████▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 373 | "▁▁▁▁▁▁▁▁▁▁█████████▁", | ||||||||||||||||||||||||||||||||||||||||
| 374 | "▁▁▁▁▁▁▁▁▁▁▁████████▁", | ||||||||||||||||||||||||||||||||||||||||
| 375 | "▁▁▁▁▁▁▁▁▁▁▁████████▁", | ||||||||||||||||||||||||||||||||||||||||
| 376 | "▁▁▁▁▁▁▁▁▁▁▁▁███████▁", | ||||||||||||||||||||||||||||||||||||||||
| 377 | "▁▁▁▁▁▁▁▁▁▁▁▁███████▁", | ||||||||||||||||||||||||||||||||||||||||
| 378 | "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", | ||||||||||||||||||||||||||||||||||||||||
| 379 | "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", | ||||||||||||||||||||||||||||||||||||||||
| 380 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", | ||||||||||||||||||||||||||||||||||||||||
| 381 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", | ||||||||||||||||||||||||||||||||||||||||
| 382 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", | ||||||||||||||||||||||||||||||||||||||||
| 383 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", | ||||||||||||||||||||||||||||||||||||||||
| 384 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", | ||||||||||||||||||||||||||||||||||||||||
| 385 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", | ||||||||||||||||||||||||||||||||||||||||
| 386 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", | ||||||||||||||||||||||||||||||||||||||||
| 387 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", | ||||||||||||||||||||||||||||||||||||||||
| 388 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", | ||||||||||||||||||||||||||||||||||||||||
| 389 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", | ||||||||||||||||||||||||||||||||||||||||
| 390 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", | ||||||||||||||||||||||||||||||||||||||||
| 391 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", | ||||||||||||||||||||||||||||||||||||||||
| 392 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 393 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 394 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", | ||||||||||||||||||||||||||||||||||||||||
| 395 | "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁" | ||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||
| 397 | ] | ||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||
| 400 | ); | ||||||||||||||||||||||||||||||||||||||||
| 401 | 3 | $SPINNERS{default} = $SPINNERS{bar}; | |||||||||||||||||||||||||||||||||||||||
| 402 | 3 | %PROGRESS = ( | |||||||||||||||||||||||||||||||||||||||
| 403 | bar => { | ||||||||||||||||||||||||||||||||||||||||
| 404 | chars => ['│', "█", '│'] | ||||||||||||||||||||||||||||||||||||||||
| 405 | }, | ||||||||||||||||||||||||||||||||||||||||
| 406 | equal => { | ||||||||||||||||||||||||||||||||||||||||
| 407 | chars => ['[', "=", ']'] | ||||||||||||||||||||||||||||||||||||||||
| 408 | }, | ||||||||||||||||||||||||||||||||||||||||
| 409 | arrow => { | ||||||||||||||||||||||||||||||||||||||||
| 410 | chars => ['│', "→", '│'] | ||||||||||||||||||||||||||||||||||||||||
| 411 | }, | ||||||||||||||||||||||||||||||||||||||||
| 412 | boxed_arrow => { | ||||||||||||||||||||||||||||||||||||||||
| 413 | chars => ['│', "⍈", '│'] | ||||||||||||||||||||||||||||||||||||||||
| 414 | }, | ||||||||||||||||||||||||||||||||||||||||
| 415 | lines => { | ||||||||||||||||||||||||||||||||||||||||
| 416 | chars => ['│', "≡", '│'] | ||||||||||||||||||||||||||||||||||||||||
| 417 | }, | ||||||||||||||||||||||||||||||||||||||||
| 418 | horizontal_lines => { | ||||||||||||||||||||||||||||||||||||||||
| 419 | chars => ['│', "▤", '│'] | ||||||||||||||||||||||||||||||||||||||||
| 420 | }, | ||||||||||||||||||||||||||||||||||||||||
| 421 | vertical_lines => { | ||||||||||||||||||||||||||||||||||||||||
| 422 | chars => ['│', "▥", '│'] | ||||||||||||||||||||||||||||||||||||||||
| 423 | }, | ||||||||||||||||||||||||||||||||||||||||
| 424 | hash => { | ||||||||||||||||||||||||||||||||||||||||
| 425 | chars => ['[', "#", ']'] | ||||||||||||||||||||||||||||||||||||||||
| 426 | }, | ||||||||||||||||||||||||||||||||||||||||
| 427 | triangle => { | ||||||||||||||||||||||||||||||||||||||||
| 428 | chars => ['│', '▶︎', '│' ] | ||||||||||||||||||||||||||||||||||||||||
| 429 | }, | ||||||||||||||||||||||||||||||||||||||||
| 430 | den_triangle => { | ||||||||||||||||||||||||||||||||||||||||
| 431 | chars => ['│', '⏅', '│' ] | ||||||||||||||||||||||||||||||||||||||||
| 432 | }, | ||||||||||||||||||||||||||||||||||||||||
| 433 | circle => { | ||||||||||||||||||||||||||||||||||||||||
| 434 | chars => ['│', 'Ⓞ', '│' ] | ||||||||||||||||||||||||||||||||||||||||
| 435 | }, | ||||||||||||||||||||||||||||||||||||||||
| 436 | den_circle => { | ||||||||||||||||||||||||||||||||||||||||
| 437 | chars => ['│', '⏂', '│' ] | ||||||||||||||||||||||||||||||||||||||||
| 438 | }, | ||||||||||||||||||||||||||||||||||||||||
| 439 | shekel => { | ||||||||||||||||||||||||||||||||||||||||
| 440 | chars => ['│', '₪', '│' ] | ||||||||||||||||||||||||||||||||||||||||
| 441 | }, | ||||||||||||||||||||||||||||||||||||||||
| 442 | dots => { | ||||||||||||||||||||||||||||||||||||||||
| 443 | chars => ['│', '▒', '│' ] | ||||||||||||||||||||||||||||||||||||||||
| 444 | }, | ||||||||||||||||||||||||||||||||||||||||
| 445 | square => { | ||||||||||||||||||||||||||||||||||||||||
| 446 | chars => ['│', '■', '│' ] | ||||||||||||||||||||||||||||||||||||||||
| 447 | }, | ||||||||||||||||||||||||||||||||||||||||
| 448 | block => { | ||||||||||||||||||||||||||||||||||||||||
| 449 | chars => ["【", "=", "】"] | ||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||
| 451 | ); | ||||||||||||||||||||||||||||||||||||||||
| 452 | 3 | $PROGRESS{default} = $PROGRESS{bar}; | |||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||
| 455 | sub new { | ||||||||||||||||||||||||||||||||||||||||
| 456 | 25 | ▶ | my ($pkg, %args) = (shift, ref $_[0] ? %{$_[0]} : @_); | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=24.2
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 457 | $args{$_} and ($VALIDATE{colours}{$args{$_}} or die "Invalid color for $_") | ||||||||||||||||||||||||||||||||||||||||
| 458 | 25 | ▶ | for qw/text_color total_color counter_color percent_color percentage_color percentages_color percents_color spinner_color progress_color elapsed_color last_elapsed_color estimate_color last_advance_epoch_color start_epoch_color epoch_color/; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$args{$_} && ($Term::ProgressSpinner::VALIDATE{'colours'}{$args{$_}} || die("Invalid color for $_"))
$Term::ProgressSpinner::VALIDATE{"colours"}{$args{$_}} or die "Invalid color for $_"
MC/DC0%0/2
$args{$_} && ($Term::ProgressSpinner::VALIDATE{'colours'}{$args{$_}} || die("Invalid color for $_"))
$args{$_}
$Term::ProgressSpinner::VALIDATE{"colours"}{$args{$_}}
Truth table33%1/3
A && B
A= $args{$_}B= $Term::ProgressSpinner::VALIDATE{"colours"}{$args{$_}}
| |||||||||||||||||||||||||||||||||||||||||
| 459 | 25 | ▶ | $args{precision} ||= 3; | ||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"precision"} ||= 3
MC/DC100%1/1
$args{"precision"} ||= 3
$args{"precision"}
Truth table100%2/2
A
A= $args{"precision"}
| |||||||||||||||||||||||||||||||||||||||||
| 460 | return bless { | ||||||||||||||||||||||||||||||||||||||||
| 461 | text_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 462 | total_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 463 | counter_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 464 | percent_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 465 | percentage_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 466 | percentages_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 467 | percents_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 468 | spinner_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 469 | elapsed_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 470 | start_epoch_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 471 | last_elapsed_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 472 | last_advance_epoch_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 473 | estimate_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 474 | epoch_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 475 | per_second_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 476 | spinner_options => $SPINNERS{ $args{spinner} || 'default' }, | ||||||||||||||||||||||||||||||||||||||||
| 477 | progress_color => 'white', | ||||||||||||||||||||||||||||||||||||||||
| 478 | progress_width => 20, | ||||||||||||||||||||||||||||||||||||||||
| 479 | 25 | ▶ | progress_options => $PROGRESS{ $args{progress} || 'default' }, | ||||||||||||||||||||||||||||||||||||||
|
Condition57%4/7
$args{'spinner'} || 'default'
$args{'progress'} || 'default'
ref $pkg || $pkg
MC/DC0%0/1
$args{'spinner'} || 'default'
$args{'spinner'}
MC/DC0%0/1
$args{'progress'} || 'default'
$args{'progress'}
MC/DC0%0/2
ref $pkg || $pkg
ref $pkg
$pkg
Truth table50%1/2
A
A= $args{'spinner'}
Truth table50%1/2
A
A= $args{'progress'}
Truth table66%2/3
A || B
A= ref $pkgB= $pkg
| |||||||||||||||||||||||||||||||||||||||||
| 480 | output => \*STDERR, | ||||||||||||||||||||||||||||||||||||||||
| 481 | progress_spinner_index => 0, | ||||||||||||||||||||||||||||||||||||||||
| 482 | progress_spinners => [], | ||||||||||||||||||||||||||||||||||||||||
| 483 | message => "{progress} {spinner} processed {percents} of {counter}/{total} {elapsed}/{estimate}", | ||||||||||||||||||||||||||||||||||||||||
| 484 | terminal_height => 0, | ||||||||||||||||||||||||||||||||||||||||
| 485 | terminal_line => 0, | ||||||||||||||||||||||||||||||||||||||||
| 486 | %args | ||||||||||||||||||||||||||||||||||||||||
| 487 | }, ref $pkg || $pkg; | ||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||
| 490 | sub progress_spinner_index { | ||||||||||||||||||||||||||||||||||||||||
| 491 | 356 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
progress_spinner_index: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 492 | 356 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 493 | 23 | ▶ | if (ref $val || $val !~ m/\d+/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $val or not $val =~ /\d+/
MC/DC0%0/2
ref $val or not $val =~ /\d+/
ref $val
not $val =~ /\d+/
Truth table33%1/3
A or not(B)
A= ref $valB= not $val =~ /\d+/
| |||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | die 'progress_spinner_index should be a integer'; | |||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||
| 496 | 23 | $self->{progress_spinner_index} = $val; | |||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||
| 498 | 356 | return $self->{progress_spinner_index}; | |||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||
| 501 | sub terminal_height { | ||||||||||||||||||||||||||||||||||||||||
| 502 | 46 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
terminal_height: called CC=4 SCAR=22.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 503 | 46 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | if (ref $val || $val !~ m/\d+/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $val or not $val =~ /\d+/
MC/DC0%0/2
ref $val or not $val =~ /\d+/
ref $val
not $val =~ /\d+/
Truth table0%0/3
A or not(B)
A= ref $valB= not $val =~ /\d+/
| |||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | die 'terminal_height should be a integer'; | |||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $self->{terminal_height} = $val; | |||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||
| 509 | 46 | return $self->{terminal_height}; | |||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||
| 512 | sub terminal_line { | ||||||||||||||||||||||||||||||||||||||||
| 513 | 69 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
terminal_line: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 514 | 69 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 515 | 23 | ▶ | if (ref $val || $val !~ m/\d+/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $val or not $val =~ /\d+/
MC/DC0%0/2
ref $val or not $val =~ /\d+/
ref $val
not $val =~ /\d+/
Truth table33%1/3
A or not(B)
A= ref $valB= not $val =~ /\d+/
| |||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | die 'terminal_line should be a integer'; | |||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||
| 518 | 23 | $self->{terminal_line} = $val; | |||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||
| 520 | 69 | return $self->{terminal_line}; | |||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||
| 523 | sub progress_spinners { | ||||||||||||||||||||||||||||||||||||||||
| 524 | 1190 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
progress_spinners: called CC=4 SCAR=21.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 525 | 1190 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | ▶ | if (ref $val || "" ne 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
ref $val or
MC/DC0%0/1
ref $val or
ref $val
Truth table0%0/2
A
A= ref $val
| |||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | die 'progress_spinners should be a array'; | |||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | $self->{progress_spinners} = $val; | |||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||
| 531 | 1190 | return $self->{progress_spinners}; | |||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||
| 534 | sub savepos { | ||||||||||||||||||||||||||||||||||||||||
| 535 | 23 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
savepos: called CC=7 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 536 | 23 | ▶ | my ($col, $rows) = $self->terminal_height ? (0, $self->terminal_height) : (Term::Size::Any::chars($self->output)); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 537 | 23 | my $x = ''; | |||||||||||||||||||||||||||||||||||||||
| 538 | 23 | ▶ | if ($self->terminal_line) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||
| 539 | 23 | $x = $self->terminal_line; | |||||||||||||||||||||||||||||||||||||||
| 540 | } elsif ($^O eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my $CONSOLE = Win32::Console->new(Win32::Console::STD_OUTPUT_HANDLE()); | |||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ($x) = $CONSOLE->Cursor(); | |||||||||||||||||||||||||||||||||||||||
| 543 | } else { | ||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | system "stty cbreak </dev/tty >/dev/tty 2>&1"; | |||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->output->print("\e[6n"); | |||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $x .= getc STDIN for 0 .. 5; | |||||||||||||||||||||||||||||||||||||||
| 547 | 0 | system "stty -cbreak </dev/tty >/dev/tty 2>&1"; | |||||||||||||||||||||||||||||||||||||||
| 548 | 0 | my($n, $m)=$x=~m/(\d+)\;(\d+)/; | |||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $x = $n; | |||||||||||||||||||||||||||||||||||||||
| 550 | 0 | $self->clear(); | |||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||
| 552 | 23 | ▶ | if ($x == $rows) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $x--; | |||||||||||||||||||||||||||||||||||||||
| 554 | 0 | for (@{ $self->progress_spinners }) { | |||||||||||||||||||||||||||||||||||||||
| 555 | 0 | $_->{savepos} = $_->{savepos} - 1; | |||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||
| 558 | 23 | $self->{savepos} = $x; | |||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||
| 561 | sub loadpos { | ||||||||||||||||||||||||||||||||||||||||
| 562 | 724 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
loadpos: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 563 | 724 | my $pos = $self->{savepos}; | |||||||||||||||||||||||||||||||||||||||
| 564 | 724 | $self->output->print("\e[$pos;1f"); | |||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||
| 567 | sub start { | ||||||||||||||||||||||||||||||||||||||||
| 568 | 23 | ▶ | my ($self, $total) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 569 | 23 | ▶ | $self->total($total) if $total; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 570 | 23 | $self->start_epoch(Time::HiRes::time); | |||||||||||||||||||||||||||||||||||||||
| 571 | 23 | $self->output->print("\e[?25l"); | |||||||||||||||||||||||||||||||||||||||
| 572 | 23 | $self->savepos; | |||||||||||||||||||||||||||||||||||||||
| 573 | 23 | $self->output->print("\n"); | |||||||||||||||||||||||||||||||||||||||
| 574 | 23 | my $ps = $self->new(%{$self}); | |||||||||||||||||||||||||||||||||||||||
| 575 | 23 | push @{ $self->progress_spinners }, $ps; | |||||||||||||||||||||||||||||||||||||||
| 576 | 23 | $self->progress_spinner_index($self->progress_spinner_index + 1); | |||||||||||||||||||||||||||||||||||||||
| 577 | 23 | return $ps; | |||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||
| 580 | sub advance { | ||||||||||||||||||||||||||||||||||||||||
| 581 | 1001 | ▶ | my ($self, $ps, $prevent) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
advance: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 582 | 1001 | ▶ | if ($ps) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 583 | 633 | ▶ | if ($ps->counter < $ps->total) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 584 | 520 | $ps->counter($ps->counter + 1); | |||||||||||||||||||||||||||||||||||||||
| 585 | 520 | my $spinner = $ps->spinner; | |||||||||||||||||||||||||||||||||||||||
| 586 | 520 | for (1 .. $spinner->{width}) { | |||||||||||||||||||||||||||||||||||||||
| 587 | 1080 | my $index = $spinner->{index}->[$_ - 1]; | |||||||||||||||||||||||||||||||||||||||
| 588 | 1080 | $spinner->{index}->[$_ - 1] = ($index + 1) % scalar @{$spinner->{chars}}; | |||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||
| 590 | 520 | ▶ | select(undef, undef, undef, $ps->slowed) if $ps->slowed; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 591 | 520 | ▶ | $ps->draw() unless $prevent; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 592 | } else { | ||||||||||||||||||||||||||||||||||||||||
| 593 | 113 | $self->finish($ps); | |||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||
| 595 | } else { | ||||||||||||||||||||||||||||||||||||||||
| 596 | 368 | for my $spinner (@{$self->progress_spinners}) { | |||||||||||||||||||||||||||||||||||||||
| 597 | 429 | $self->advance($spinner, 1); | |||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||
| 599 | 368 | ▶ | scalar @{$self->{progress_spinners}} ? $self->draw() : $self->finish; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||
| 603 | sub time_advance_elapsed { | ||||||||||||||||||||||||||||||||||||||||
| 604 | 724 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
time_advance_elapsed: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 605 | 724 | my %time = (); | |||||||||||||||||||||||||||||||||||||||
| 606 | 724 | $time{epoch} = sprintf($self->precision, Time::HiRes::time); | |||||||||||||||||||||||||||||||||||||||
| 607 | 724 | $time{start_epoch} = sprintf($self->precision, $self->start_epoch); | |||||||||||||||||||||||||||||||||||||||
| 608 | 724 | ▶ | $time{last_advance_epoch} = $self->last_advance_epoch || $time{start_epoch}; | ||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->last_advance_epoch || $time{'start_epoch'}
MC/DC0%0/2
$self->last_advance_epoch || $time{'start_epoch'}
$self->last_advance_epoch
$time{'start_epoch'}
Truth table66%2/3
A || B
A= $self->last_advance_epochB= $time{'start_epoch'}
| |||||||||||||||||||||||||||||||||||||||||
| 609 | 724 | $time{last_elapsed} = sprintf($self->precision, $time{epoch} - $time{last_advance_epoch}) + 0; | |||||||||||||||||||||||||||||||||||||||
| 610 | 724 | $time{elapsed} = sprintf($self->precision, $time{epoch} - $time{start_epoch}) + 0; | |||||||||||||||||||||||||||||||||||||||
| 611 | 724 | for (qw/epoch start_epoch last_advance_epoch last_elapsed elapsed/) { | |||||||||||||||||||||||||||||||||||||||
| 612 | 3620 | $time{"${_}_second"} = int($time{$_}); | |||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||
| 614 | 724 | $self->last_advance_epoch($time{epoch}); | |||||||||||||||||||||||||||||||||||||||
| 615 | 724 | return %time; | |||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||
| 618 | sub draw { | ||||||||||||||||||||||||||||||||||||||||
| 619 | 1186 | ▶ | my ($self, $ps) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
draw: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 620 | 1186 | ▶ | if ($ps) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 621 | 724 | $ps->loadpos; | |||||||||||||||||||||||||||||||||||||||
| 622 | 724 | $ps->clear(); | |||||||||||||||||||||||||||||||||||||||
| 623 | 724 | my ($spinner, $progress, $available, %options) = ($ps->spinner, $ps->progress, $ps->progress_width, $ps->time_advance_elapsed); | |||||||||||||||||||||||||||||||||||||||
| 624 | 724 | $options{total} = $ps->total; | |||||||||||||||||||||||||||||||||||||||
| 625 | 724 | $options{counter} = $ps->counter; | |||||||||||||||||||||||||||||||||||||||
| 626 | 724 | $options{spinner} = color($ps->spinner_color); | |||||||||||||||||||||||||||||||||||||||
| 627 | $options{spinner} .= $spinner->{chars}->[ | ||||||||||||||||||||||||||||||||||||||||
| 628 | $spinner->{index}->[$_ - 1] | ||||||||||||||||||||||||||||||||||||||||
| 629 | 724 | ] for (1 .. $spinner->{width}); | |||||||||||||||||||||||||||||||||||||||
| 630 | 724 | $options{spinner} .= color($ps->text_color); | |||||||||||||||||||||||||||||||||||||||
| 631 | 724 | $options{percent} = int( ( $options{counter} / $options{total} ) * 100 ); | |||||||||||||||||||||||||||||||||||||||
| 632 | 724 | $options{percentage} = ($available / 100) * $options{percent}; | |||||||||||||||||||||||||||||||||||||||
| 633 | 724 | ▶ | $options{estimate} = $options{percent} ? sprintf($self->precision, (($options{elapsed} / $options{percent}) * 100) - $options{elapsed}) + 0 : 0; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 634 | 724 | $options{estimate_second} = int($options{estimate} + 0.5); | |||||||||||||||||||||||||||||||||||||||
| 635 | $options{per_second} = $options{elapsed_seconds} ? | ||||||||||||||||||||||||||||||||||||||||
| 636 | 724 | ▶ | int(($options{counter} / int($options{elapsed_second})) + 0.5) | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 637 | : 0; | ||||||||||||||||||||||||||||||||||||||||
| 638 | $options{progress} = sprintf("%s%s%s%s%s", | ||||||||||||||||||||||||||||||||||||||||
| 639 | color($ps->progress_color), | ||||||||||||||||||||||||||||||||||||||||
| 640 | $progress->{chars}->[0], | ||||||||||||||||||||||||||||||||||||||||
| 641 | ( $progress->{chars}->[1] x int($options{percentage} + 0.5) ) . ( ' ' x int( ($available - $options{percentage}) + 0.5 ) ), | ||||||||||||||||||||||||||||||||||||||||
| 642 | 724 | $progress->{chars}->[2], | |||||||||||||||||||||||||||||||||||||||
| 643 | color($ps->text_color) | ||||||||||||||||||||||||||||||||||||||||
| 644 | ); | ||||||||||||||||||||||||||||||||||||||||
| 645 | 724 | $options{percentages} = $options{percentage} . '%'; | |||||||||||||||||||||||||||||||||||||||
| 646 | 724 | $options{percents} = $options{percent} . '%'; | |||||||||||||||||||||||||||||||||||||||
| 647 | $options{$_} = sprintf ("%s%s%s", | ||||||||||||||||||||||||||||||||||||||||
| 648 | color($ps->{$_ . "_color"}), | ||||||||||||||||||||||||||||||||||||||||
| 649 | $options{$_}, | ||||||||||||||||||||||||||||||||||||||||
| 650 | color($ps->text_color) | ||||||||||||||||||||||||||||||||||||||||
| 651 | 724 | ) for (qw/total percent percents percentage counter per_second/); | |||||||||||||||||||||||||||||||||||||||
| 652 | 724 | for (qw/elapsed last_elapsed estimate last_advance_epoch start_epoch epoch/) { | |||||||||||||||||||||||||||||||||||||||
| 653 | $options{$_} = sprintf ("%s%s%s", | ||||||||||||||||||||||||||||||||||||||||
| 654 | color($ps->{$_ . "_color"}), | ||||||||||||||||||||||||||||||||||||||||
| 655 | 4344 | $options{$_}, | |||||||||||||||||||||||||||||||||||||||
| 656 | color($ps->text_color) | ||||||||||||||||||||||||||||||||||||||||
| 657 | ); | ||||||||||||||||||||||||||||||||||||||||
| 658 | $options{"${_}_second"} = sprintf ("%s%s%s", | ||||||||||||||||||||||||||||||||||||||||
| 659 | color($ps->{$_ . "_color"}), | ||||||||||||||||||||||||||||||||||||||||
| 660 | 4344 | $options{"${_}_second"}, | |||||||||||||||||||||||||||||||||||||||
| 661 | color($ps->text_color) | ||||||||||||||||||||||||||||||||||||||||
| 662 | ); | ||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||
| 664 | 724 | my $message = $ps->message; | |||||||||||||||||||||||||||||||||||||||
| 665 | 724 | $message =~ s/$VALIDATE{msg_regex}/$options{$1}/ig; | |||||||||||||||||||||||||||||||||||||||
| 666 | 724 | $message .= color('reset') . "\n"; | |||||||||||||||||||||||||||||||||||||||
| 667 | 724 | $ps->output->print($message); | |||||||||||||||||||||||||||||||||||||||
| 668 | 724 | return $ps->drawn(1); | |||||||||||||||||||||||||||||||||||||||
| 669 | } else { | ||||||||||||||||||||||||||||||||||||||||
| 670 | 462 | for my $spinner (@{$self->progress_spinners}) { | |||||||||||||||||||||||||||||||||||||||
| 671 | 724 | $self->draw($spinner); | |||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||
| 673 | 462 | return $self->drawn(1); | |||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||
| 677 | sub finish { | ||||||||||||||||||||||||||||||||||||||||
| 678 | 129 | ▶ | my ($self, $sp) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 679 | 129 | ▶ | if ($sp && scalar @{$self->progress_spinners}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$sp and scalar @{$self->progress_spinners;}
MC/DC100%1/1
$sp and scalar @{$self->progress_spinners;}
$sp
Truth table100%2/2
A
A= $sp
| |||||||||||||||||||||||||||||||||||||||||
| 680 | 112 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||
| 681 | 112 | for (@{ $self->progress_spinners }) { | |||||||||||||||||||||||||||||||||||||||
| 682 | 155 | ▶ | if ($sp->progress_spinner_index == $_->progress_spinner_index) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 683 | 23 | last; | |||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||
| 685 | 132 | $i++; | |||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||
| 687 | 112 | splice @{$self->progress_spinners}, $i, 1; | |||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||
| 689 | } else { | ||||||||||||||||||||||||||||||||||||||||
| 690 | 17 | $self->output->print("\e[?25h"); | |||||||||||||||||||||||||||||||||||||||
| 691 | 17 | $self->finished(1); | |||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||
| 693 | 129 | return 0; | |||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||
| 696 | sub finished { | ||||||||||||||||||||||||||||||||||||||||
| 697 | 273 | ▶ | if (defined $_[1]) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
finished: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 698 | 17 | $_[0]->{finished} = $_[1]; | |||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||
| 700 | 273 | $_[0]->{finished}; | |||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||
| 703 | sub drawn { | ||||||||||||||||||||||||||||||||||||||||
| 704 | 1925 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
drawn: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 705 | 1925 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 706 | 1925 | $self->{drawn} = $val; | |||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||
| 708 | 1925 | return $self->{drawn}; | |||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||
| 711 | sub clear { | ||||||||||||||||||||||||||||||||||||||||
| 712 | 739 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 713 | 739 | $self->output->print("\r\e[2K"); | |||||||||||||||||||||||||||||||||||||||
| 714 | 739 | $self->drawn(0); | |||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||
| 717 | sub message { | ||||||||||||||||||||||||||||||||||||||||
| 718 | 724 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
message: called CC=3 SCAR=16.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 719 | 724 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | if (ref $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | die 'message should be a string'; | |||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | $self->{message} = $val; | |||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||
| 725 | 724 | return $self->{message}; | |||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||
| 728 | sub output { | ||||||||||||||||||||||||||||||||||||||||
| 729 | 2253 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 730 | 2253 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $self->{output} = $val; | |||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||
| 733 | 2253 | return $self->{output}; | |||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||
| 736 | sub total { | ||||||||||||||||||||||||||||||||||||||||
| 737 | 1380 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
total: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 738 | 1380 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 739 | 23 | ▶ | if ($val !~ m/\d+/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | die "total should be a integer"; | |||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||
| 742 | 23 | $self->{total} = $val; | |||||||||||||||||||||||||||||||||||||||
| 743 | 23 | $self->{counter} = 0; | |||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||
| 745 | 1380 | return $self->{total}; | |||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||
| 748 | sub slowed { | ||||||||||||||||||||||||||||||||||||||||
| 749 | 1042 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
slowed: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 750 | 1042 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 751 | 2 | ▶ | if ($val !~ m/\d+(\.\d+)?/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | die "slowed should be a float"; | |||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||
| 754 | 2 | $self->{slowed} = $val; | |||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||
| 756 | 1042 | return $self->{slowed}; | |||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||
| 759 | sub counter { | ||||||||||||||||||||||||||||||||||||||||
| 760 | 2397 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
counter: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 761 | 2397 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 762 | 520 | ▶ | if ($val !~ m/\d+/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | die "counter should be a integer"; | |||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||
| 765 | 520 | $self->{counter} = $val; | |||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||
| 767 | 2397 | return $self->{counter}; | |||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||
| 770 | sub start_epoch { | ||||||||||||||||||||||||||||||||||||||||
| 771 | 747 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_epoch: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 772 | 747 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 773 | 23 | ▶ | if ($val !~ m/\d+(\.\d+)?/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | die "start_epoch should be a epoch"; | |||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||
| 776 | 23 | $self->{start_epoch} = $val; | |||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||
| 778 | 747 | return $self->{start_epoch}; | |||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||
| 781 | sub last_advance_epoch { | ||||||||||||||||||||||||||||||||||||||||
| 782 | 1448 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
last_advance_epoch: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 783 | 1448 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 784 | 724 | ▶ | if ($val !~ m/\d+(\.\d+)?/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | die "last_advance_epoch should be a epoch"; | |||||||||||||||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||||||||||||||
| 787 | 724 | $self->{last_advance_epoch} = $val; | |||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||
| 789 | 1448 | return $self->{last_advance_epoch}; | |||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||
| 792 | sub precision { | ||||||||||||||||||||||||||||||||||||||||
| 793 | 3614 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
precision: called CC=3 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 794 | 3614 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | ▶ | if ($val !~ m/\d+/) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | die "last_advance_epoch should be a epoch"; | |||||||||||||||||||||||||||||||||||||||
| 797 | } | ||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | $self->{precision} = $val; | |||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||
| 800 | 3614 | $val = $self->{precision}; | |||||||||||||||||||||||||||||||||||||||
| 801 | 3614 | return "%.${val}f"; | |||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||
| 804 | sub text_color { | ||||||||||||||||||||||||||||||||||||||||
| 805 | 14480 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_color: called CC=3 SCAR=16.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 806 | 14480 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | $self->{text_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||
| 812 | 14480 | return $self->{text_color}; | |||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||
| 815 | sub spinner { | ||||||||||||||||||||||||||||||||||||||||
| 816 | 1259 | ▶ | my ($self, $spinner) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
spinner: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 817 | 1259 | ▶ | $self->{spinner_options} = $SPINNERS{$spinner} or die "Invalid spinner $spinner" if $spinner; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$spinner && (($self->{'spinner_options'} = $SPINNERS{$spinner}) || die("Invalid spinner $spinner"))
$self->{"spinner_options"} = $SPINNERS{$spinner} or die "Invalid spinner $spinner"
MC/DC0%0/2
$spinner && (($self->{'spinner_options'} = $SPINNERS{$spinner}) || die("Invalid spinner $spinner"))
$spinner
$self->{"spinner_options"} = $SPINNERS{$spinner}
Truth table33%1/3
A && B
A= $spinnerB= $self->{"spinner_options"} = $SPINNERS{$spinner}
| |||||||||||||||||||||||||||||||||||||||||
| 818 | 1259 | $self->{spinner_options}; | |||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||
| 821 | sub spinner_color { | ||||||||||||||||||||||||||||||||||||||||
| 822 | 724 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
spinner_color: called CC=3 SCAR=16.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 823 | 724 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | $self->{spinner_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||||||||||||||
| 829 | 724 | return $self->{spinner_color}; | |||||||||||||||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||
| 832 | sub progress { | ||||||||||||||||||||||||||||||||||||||||
| 833 | 739 | ▶ | my ($self, $progress) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
progress: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 834 | 739 | ▶ | $self->{progress_options} = $PROGRESS{$progress} or die "Invalid progress $progress" if $progress; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$progress && (($self->{'progress_options'} = $PROGRESS{$progress}) || die("Invalid progress $progress"))
$self->{"progress_options"} = $PROGRESS{$progress} or die "Invalid progress $progress"
MC/DC0%0/2
$progress && (($self->{'progress_options'} = $PROGRESS{$progress}) || die("Invalid progress $progress"))
$progress
$self->{"progress_options"} = $PROGRESS{$progress}
Truth table33%1/3
A && B
A= $progressB= $self->{"progress_options"} = $PROGRESS{$progress}
| |||||||||||||||||||||||||||||||||||||||||
| 835 | 739 | $self->{progress_options}; | |||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||
| 838 | sub progress_color { | ||||||||||||||||||||||||||||||||||||||||
| 839 | 724 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
progress_color: called CC=3 SCAR=16.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 840 | 724 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | $self->{progress_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||
| 846 | 724 | return $self->{progress_color}; | |||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||
| 849 | sub progress_width { | ||||||||||||||||||||||||||||||||||||||||
| 850 | 724 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
progress_width: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 851 | 724 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | $self->{progress_width} = $val; | |||||||||||||||||||||||||||||||||||||||
| 853 | } | ||||||||||||||||||||||||||||||||||||||||
| 854 | 724 | return $self->{progress_width}; | |||||||||||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||
| 857 | sub percent_color { | ||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
percent_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | $self->{percent_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | return $self->{percent_color}; | |||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||
| 868 | sub percents_color { | ||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
percents_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 873 | } | ||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | $self->{percents_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | return $self->{percents_color}; | |||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||
| 879 | sub percentage_color { | ||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
percentage_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | $self->{percentage_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 886 | } | ||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | return $self->{percentage_color}; | |||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||
| 890 | sub percentages_color { | ||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
percentages_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | $self->{percentages_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | return $self->{percentages_color}; | |||||||||||||||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||
| 901 | sub total_color { | ||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
total_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $self->{total_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | return $self->{total_color}; | |||||||||||||||||||||||||||||||||||||||
| 910 | } | ||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||
| 912 | sub counter_color { | ||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
counter_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | $self->{counter_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | return $self->{counter_color}; | |||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||
| 923 | sub elapsed_color { | ||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
elapsed_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $self->{elapsed_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | return $self->{elapsed_color}; | |||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||
| 934 | sub last_elapsed_color { | ||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
last_elapsed_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | $self->{last_elapsed_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | return $self->{last_elapsed_color}; | |||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||
| 945 | sub estimate_color { | ||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
estimate_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | $self->{estimate_elapsed_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | return $self->{estimate_elapsed_color}; | |||||||||||||||||||||||||||||||||||||||
| 954 | } | ||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||
| 956 | sub last_advance_epoch_color { | ||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
last_advance_epoch_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | $self->{last_advance_epoch_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | return $self->{last_advance_epoch_color}; | |||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||
| 967 | sub start_epoch_color { | ||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_epoch_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 971 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 972 | } | ||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | $self->{start_epoch_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 974 | } | ||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | return $self->{start_epoch_color}; | |||||||||||||||||||||||||||||||||||||||
| 976 | } | ||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||
| 978 | sub epoch_color { | ||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
epoch_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 983 | } | ||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | $self->{epoch_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 985 | } | ||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | return $self->{epoch_color}; | |||||||||||||||||||||||||||||||||||||||
| 987 | } | ||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||
| 989 | sub per_second_color { | ||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | ▶ | my ($self, $val) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
per_second_color: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | ▶ | unless ($VALIDATE{colours}{$val}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 993 | 0 | die "$val is not a valid color"; | |||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | $self->{per_second_color} = $val; | |||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | return $self->{per_second_color}; | |||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||
| 1000 | sub sleep { | ||||||||||||||||||||||||||||||||||||||||
| 1001 | 16 | ▶ | select(undef, undef, undef, $_[1]); | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
sleep: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||
| 1004 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||
| 1006 | __END__; | ||||||||||||||||||||||||||||||||||||||||