| 1 | package Iterator::Flex::Common; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Iterator Generators and Adapters | ||||||||||
| 4 | |||||||||||
| 5 | 26 | ▶ | use v5.28; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 26 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 26 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 26 | ▶ | use experimental qw( postderef signatures ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 26 | our $VERSION = '0.33'; | |||||||||
| 12 | |||||||||||
| 13 | 26 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 26 | our @EXPORT_OK = qw[ | |||||||||
| 16 | iterator iter iarray ibatch ibuffer icycle icache | ||||||||||
| 17 | icat ichain ichunk iflatten igather igrep imap | ||||||||||
| 18 | ipermute | ||||||||||
| 19 | iproduct iseq istack itake ifreeze izip | ||||||||||
| 20 | thaw | ||||||||||
| 21 | ]; | ||||||||||
| 22 | |||||||||||
| 23 | 26 | our %EXPORT_TAGS = ( all => \@EXPORT_OK ); | |||||||||
| 24 | |||||||||||
| 25 | 26 | ▶ | use Ref::Util qw[ is_arrayref is_hashref is_ref is_globref ]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 26 | ▶ | use Module::Runtime qw[ require_module ]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 26 | ▶ | use Iterator::Flex::Utils qw[ throw_failure ]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 26 | ▶ | use Iterator::Flex::Factory 'to_iterator', 'construct_from_iterable'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | |||||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | |||||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | |||||||||||
| 51 | |||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | |||||||||||
| 57 | 50 | ▶ | sub iterator : prototype(&@) ( $code, $pars = {} ) { | ||||||||
|
Subroutine
iterator: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 58 | 50 | Iterator::Flex::Factory::construct_from_iterable( $code, $pars ); | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | |||||||||||
| 66 | |||||||||||
| 67 | |||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | |||||||||||
| 71 | |||||||||||
| 72 | |||||||||||
| 73 | |||||||||||
| 74 | |||||||||||
| 75 | |||||||||||
| 76 | |||||||||||
| 77 | 0 | ▶ | sub iter ( $iterable, $pars = {} ) { | ||||||||
|
Subroutine
iter: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 78 | 0 | to_iterator( $iterable, $pars ); | |||||||||
| 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 | 27 | ▶ | sub iarray ( $array, $pars = {} ) { | ||||||||
|
Subroutine
iarray: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 109 | 27 | require Iterator::Flex::Array; | |||||||||
| 110 | 27 | return Iterator::Flex::Array->new( $array, $pars ); | |||||||||
| 111 | } | ||||||||||
| 112 | |||||||||||
| 113 | |||||||||||
| 114 | |||||||||||
| 115 | |||||||||||
| 116 | |||||||||||
| 117 | |||||||||||
| 118 | |||||||||||
| 119 | |||||||||||
| 120 | |||||||||||
| 121 | |||||||||||
| 122 | |||||||||||
| 123 | |||||||||||
| 124 | |||||||||||
| 125 | |||||||||||
| 126 | |||||||||||
| 127 | |||||||||||
| 128 | |||||||||||
| 129 | |||||||||||
| 130 | |||||||||||
| 131 | |||||||||||
| 132 | |||||||||||
| 133 | |||||||||||
| 134 | |||||||||||
| 135 | |||||||||||
| 136 | |||||||||||
| 137 | |||||||||||
| 138 | |||||||||||
| 139 | |||||||||||
| 140 | 8 | ▶ | sub icache ( $iterable, $pars = {} ) { | ||||||||
|
Subroutine
icache: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 141 | 8 | require Iterator::Flex::Cache; | |||||||||
| 142 | 8 | Iterator::Flex::Cache->new( $iterable, $pars ); | |||||||||
| 143 | } | ||||||||||
| 144 | |||||||||||
| 145 | |||||||||||
| 146 | |||||||||||
| 147 | |||||||||||
| 148 | |||||||||||
| 149 | |||||||||||
| 150 | |||||||||||
| 151 | |||||||||||
| 152 | |||||||||||
| 153 | |||||||||||
| 154 | |||||||||||
| 155 | |||||||||||
| 156 | |||||||||||
| 157 | |||||||||||
| 158 | |||||||||||
| 159 | |||||||||||
| 160 | |||||||||||
| 161 | |||||||||||
| 162 | |||||||||||
| 163 | |||||||||||
| 164 | |||||||||||
| 165 | |||||||||||
| 166 | |||||||||||
| 167 | |||||||||||
| 168 | |||||||||||
| 169 | |||||||||||
| 170 | |||||||||||
| 171 | |||||||||||
| 172 | |||||||||||
| 173 | |||||||||||
| 174 | |||||||||||
| 175 | |||||||||||
| 176 | |||||||||||
| 177 | |||||||||||
| 178 | |||||||||||
| 179 | |||||||||||
| 180 | |||||||||||
| 181 | |||||||||||
| 182 | |||||||||||
| 183 | |||||||||||
| 184 | ▶ | sub icat ( @args ) { | |||||||||
|
Subroutine
icat: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 185 | 2 | require Iterator::Flex::Cat; | |||||||||
| 186 | 2 | Iterator::Flex::Cat->new( @args ); | |||||||||
| 187 | } | ||||||||||
| 188 | |||||||||||
| 189 | sub ichain; | ||||||||||
| 190 | 26 | *ichain = \&icat; | |||||||||
| 191 | |||||||||||
| 192 | |||||||||||
| 193 | |||||||||||
| 194 | |||||||||||
| 195 | |||||||||||
| 196 | |||||||||||
| 197 | |||||||||||
| 198 | |||||||||||
| 199 | |||||||||||
| 200 | |||||||||||
| 201 | |||||||||||
| 202 | |||||||||||
| 203 | |||||||||||
| 204 | |||||||||||
| 205 | |||||||||||
| 206 | |||||||||||
| 207 | |||||||||||
| 208 | |||||||||||
| 209 | |||||||||||
| 210 | |||||||||||
| 211 | |||||||||||
| 212 | |||||||||||
| 213 | |||||||||||
| 214 | |||||||||||
| 215 | |||||||||||
| 216 | |||||||||||
| 217 | |||||||||||
| 218 | |||||||||||
| 219 | |||||||||||
| 220 | 0 | ▶ | sub ichunk ( $iterable, $pars = {} ) { | ||||||||
|
Subroutine
ichunk: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 221 | 0 | require Iterator::Flex::Chunk; | |||||||||
| 222 | 0 | Iterator::Flex::Chunk->new( $iterable, $pars ); | |||||||||
| 223 | } | ||||||||||
| 224 | |||||||||||
| 225 | sub ibatch; | ||||||||||
| 226 | 26 | *ibatch = \&ichunk; | |||||||||
| 227 | |||||||||||
| 228 | |||||||||||
| 229 | |||||||||||
| 230 | |||||||||||
| 231 | |||||||||||
| 232 | |||||||||||
| 233 | |||||||||||
| 234 | |||||||||||
| 235 | |||||||||||
| 236 | |||||||||||
| 237 | |||||||||||
| 238 | |||||||||||
| 239 | |||||||||||
| 240 | |||||||||||
| 241 | |||||||||||
| 242 | |||||||||||
| 243 | |||||||||||
| 244 | |||||||||||
| 245 | |||||||||||
| 246 | |||||||||||
| 247 | |||||||||||
| 248 | |||||||||||
| 249 | |||||||||||
| 250 | |||||||||||
| 251 | |||||||||||
| 252 | |||||||||||
| 253 | 4 | ▶ | sub icycle ( $array, $pars = {} ) { | ||||||||
|
Subroutine
icycle: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 254 | 4 | require Iterator::Flex::Cycle; | |||||||||
| 255 | 4 | return Iterator::Flex::Cycle->new( $array, $pars ); | |||||||||
| 256 | } | ||||||||||
| 257 | |||||||||||
| 258 | |||||||||||
| 259 | |||||||||||
| 260 | |||||||||||
| 261 | |||||||||||
| 262 | |||||||||||
| 263 | |||||||||||
| 264 | |||||||||||
| 265 | |||||||||||
| 266 | |||||||||||
| 267 | |||||||||||
| 268 | |||||||||||
| 269 | |||||||||||
| 270 | |||||||||||
| 271 | |||||||||||
| 272 | |||||||||||
| 273 | |||||||||||
| 274 | |||||||||||
| 275 | 7 | ▶ | sub ibuffer ( $iterable, $n = 0, $pars = {} ) { | ||||||||
|
Subroutine
ibuffer: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 276 | 7 | require Iterator::Flex::Buffer; | |||||||||
| 277 | 7 | return Iterator::Flex::Buffer->new( $iterable, $n, $pars ); | |||||||||
| 278 | } | ||||||||||
| 279 | |||||||||||
| 280 | |||||||||||
| 281 | |||||||||||
| 282 | |||||||||||
| 283 | |||||||||||
| 284 | |||||||||||
| 285 | |||||||||||
| 286 | |||||||||||
| 287 | |||||||||||
| 288 | |||||||||||
| 289 | |||||||||||
| 290 | |||||||||||
| 291 | |||||||||||
| 292 | |||||||||||
| 293 | |||||||||||
| 294 | |||||||||||
| 295 | |||||||||||
| 296 | |||||||||||
| 297 | |||||||||||
| 298 | |||||||||||
| 299 | |||||||||||
| 300 | |||||||||||
| 301 | 5 | ▶ | sub iflatten ( $iterable, $pars = {} ) { | ||||||||
|
Subroutine
iflatten: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 302 | 5 | require Iterator::Flex::Flatten; | |||||||||
| 303 | 5 | return Iterator::Flex::Flatten->new( $iterable, $pars ); | |||||||||
| 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 | 1 | ▶ | sub igather : prototype(&$@) ( $code, $iterable, $pars = {} ) { | ||||||||
|
Subroutine
igather: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 332 | 1 | require Iterator::Flex::Gather; | |||||||||
| 333 | 1 | Iterator::Flex::Gather->new( $code, $iterable, $pars ); | |||||||||
| 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 | 6 | ▶ | sub igrep : prototype(&$@) ( $code, $iterable, $pars = {} ) { | ||||||||
|
Subroutine
igrep: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 359 | 6 | require Iterator::Flex::Grep; | |||||||||
| 360 | 6 | Iterator::Flex::Grep->new( $code, $iterable, $pars ); | |||||||||
| 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 | 6 | ▶ | sub imap : prototype(&$@) ( $code, $iterable, $pars = {} ) { | ||||||||
|
Subroutine
imap: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 387 | 6 | require Iterator::Flex::Map; | |||||||||
| 388 | 6 | Iterator::Flex::Map->new( $code, $iterable, $pars ); | |||||||||
| 389 | } | ||||||||||
| 390 | |||||||||||
| 391 | |||||||||||
| 392 | |||||||||||
| 393 | |||||||||||
| 394 | |||||||||||
| 395 | |||||||||||
| 396 | |||||||||||
| 397 | |||||||||||
| 398 | |||||||||||
| 399 | |||||||||||
| 400 | |||||||||||
| 401 | |||||||||||
| 402 | |||||||||||
| 403 | |||||||||||
| 404 | |||||||||||
| 405 | |||||||||||
| 406 | |||||||||||
| 407 | |||||||||||
| 408 | |||||||||||
| 409 | |||||||||||
| 410 | |||||||||||
| 411 | |||||||||||
| 412 | |||||||||||
| 413 | |||||||||||
| 414 | |||||||||||
| 415 | |||||||||||
| 416 | |||||||||||
| 417 | |||||||||||
| 418 | sub ipermute { | ||||||||||
| 419 | 0 | ▶ | require Iterator::Flex::Permute; | ||||||||
|
Subroutine
ipermute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 420 | 0 | return Iterator::Flex::Permute->new( @_ ); | |||||||||
| 421 | } | ||||||||||
| 422 | |||||||||||
| 423 | |||||||||||
| 424 | |||||||||||
| 425 | |||||||||||
| 426 | |||||||||||
| 427 | |||||||||||
| 428 | |||||||||||
| 429 | |||||||||||
| 430 | |||||||||||
| 431 | |||||||||||
| 432 | |||||||||||
| 433 | |||||||||||
| 434 | |||||||||||
| 435 | |||||||||||
| 436 | |||||||||||
| 437 | |||||||||||
| 438 | |||||||||||
| 439 | |||||||||||
| 440 | |||||||||||
| 441 | |||||||||||
| 442 | |||||||||||
| 443 | |||||||||||
| 444 | |||||||||||
| 445 | |||||||||||
| 446 | |||||||||||
| 447 | |||||||||||
| 448 | |||||||||||
| 449 | |||||||||||
| 450 | |||||||||||
| 451 | |||||||||||
| 452 | |||||||||||
| 453 | |||||||||||
| 454 | |||||||||||
| 455 | |||||||||||
| 456 | |||||||||||
| 457 | |||||||||||
| 458 | |||||||||||
| 459 | sub iproduct { | ||||||||||
| 460 | 6 | ▶ | require Iterator::Flex::Product; | ||||||||
|
Subroutine
iproduct: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 461 | 6 | return Iterator::Flex::Product->new( @_ ); | |||||||||
| 462 | } | ||||||||||
| 463 | |||||||||||
| 464 | |||||||||||
| 465 | |||||||||||
| 466 | |||||||||||
| 467 | |||||||||||
| 468 | |||||||||||
| 469 | |||||||||||
| 470 | |||||||||||
| 471 | |||||||||||
| 472 | |||||||||||
| 473 | |||||||||||
| 474 | |||||||||||
| 475 | |||||||||||
| 476 | |||||||||||
| 477 | |||||||||||
| 478 | |||||||||||
| 479 | |||||||||||
| 480 | |||||||||||
| 481 | |||||||||||
| 482 | |||||||||||
| 483 | |||||||||||
| 484 | |||||||||||
| 485 | |||||||||||
| 486 | |||||||||||
| 487 | |||||||||||
| 488 | |||||||||||
| 489 | |||||||||||
| 490 | |||||||||||
| 491 | |||||||||||
| 492 | |||||||||||
| 493 | |||||||||||
| 494 | |||||||||||
| 495 | sub iseq { | ||||||||||
| 496 | 67 | ▶ | require Iterator::Flex::Sequence; | ||||||||
|
Subroutine
iseq: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 497 | 67 | Iterator::Flex::Sequence->new( @_ ); | |||||||||
| 498 | } | ||||||||||
| 499 | |||||||||||
| 500 | |||||||||||
| 501 | |||||||||||
| 502 | |||||||||||
| 503 | |||||||||||
| 504 | |||||||||||
| 505 | |||||||||||
| 506 | |||||||||||
| 507 | |||||||||||
| 508 | |||||||||||
| 509 | |||||||||||
| 510 | |||||||||||
| 511 | |||||||||||
| 512 | |||||||||||
| 513 | |||||||||||
| 514 | |||||||||||
| 515 | |||||||||||
| 516 | |||||||||||
| 517 | |||||||||||
| 518 | |||||||||||
| 519 | |||||||||||
| 520 | |||||||||||
| 521 | |||||||||||
| 522 | |||||||||||
| 523 | |||||||||||
| 524 | |||||||||||
| 525 | |||||||||||
| 526 | |||||||||||
| 527 | |||||||||||
| 528 | |||||||||||
| 529 | ▶ | sub istack ( @args ) { | |||||||||
|
Subroutine
istack: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 530 | 3 | require Iterator::Flex::Stack; | |||||||||
| 531 | 3 | Iterator::Flex::Stack->new( @args ); | |||||||||
| 532 | } | ||||||||||
| 533 | |||||||||||
| 534 | |||||||||||
| 535 | |||||||||||
| 536 | |||||||||||
| 537 | |||||||||||
| 538 | |||||||||||
| 539 | |||||||||||
| 540 | |||||||||||
| 541 | |||||||||||
| 542 | |||||||||||
| 543 | |||||||||||
| 544 | |||||||||||
| 545 | |||||||||||
| 546 | |||||||||||
| 547 | |||||||||||
| 548 | |||||||||||
| 549 | |||||||||||
| 550 | |||||||||||
| 551 | |||||||||||
| 552 | |||||||||||
| 553 | |||||||||||
| 554 | |||||||||||
| 555 | |||||||||||
| 556 | |||||||||||
| 557 | |||||||||||
| 558 | |||||||||||
| 559 | |||||||||||
| 560 | |||||||||||
| 561 | |||||||||||
| 562 | |||||||||||
| 563 | |||||||||||
| 564 | |||||||||||
| 565 | ▶ | sub itake ( @args ) { | |||||||||
|
Subroutine
itake: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 566 | 12 | require Iterator::Flex::Take; | |||||||||
| 567 | 12 | Iterator::Flex::Take->new( @args ); | |||||||||
| 568 | } | ||||||||||
| 569 | |||||||||||
| 570 | |||||||||||
| 571 | |||||||||||
| 572 | |||||||||||
| 573 | |||||||||||
| 574 | |||||||||||
| 575 | |||||||||||
| 576 | |||||||||||
| 577 | |||||||||||
| 578 | |||||||||||
| 579 | |||||||||||
| 580 | |||||||||||
| 581 | |||||||||||
| 582 | |||||||||||
| 583 | |||||||||||
| 584 | |||||||||||
| 585 | |||||||||||
| 586 | |||||||||||
| 587 | |||||||||||
| 588 | |||||||||||
| 589 | |||||||||||
| 590 | |||||||||||
| 591 | |||||||||||
| 592 | |||||||||||
| 593 | |||||||||||
| 594 | |||||||||||
| 595 | |||||||||||
| 596 | |||||||||||
| 597 | |||||||||||
| 598 | |||||||||||
| 599 | |||||||||||
| 600 | |||||||||||
| 601 | |||||||||||
| 602 | 4 | ▶ | sub ifreeze : prototype(&$@) ( $code, $iterable, $pars = {} ) { | ||||||||
|
Subroutine
ifreeze: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 603 | 4 | require Iterator::Flex::Freeze; | |||||||||
| 604 | 4 | Iterator::Flex::Freeze->new( $code, $iterable, $pars ); | |||||||||
| 605 | } | ||||||||||
| 606 | |||||||||||
| 607 | |||||||||||
| 608 | |||||||||||
| 609 | |||||||||||
| 610 | |||||||||||
| 611 | |||||||||||
| 612 | |||||||||||
| 613 | |||||||||||
| 614 | |||||||||||
| 615 | |||||||||||
| 616 | |||||||||||
| 617 | |||||||||||
| 618 | |||||||||||
| 619 | |||||||||||
| 620 | |||||||||||
| 621 | |||||||||||
| 622 | |||||||||||
| 623 | |||||||||||
| 624 | |||||||||||
| 625 | |||||||||||
| 626 | |||||||||||
| 627 | |||||||||||
| 628 | |||||||||||
| 629 | |||||||||||
| 630 | |||||||||||
| 631 | |||||||||||
| 632 | |||||||||||
| 633 | |||||||||||
| 634 | ▶ | sub izip ( @args ) { | |||||||||
|
Subroutine
izip: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 635 | 13 | require Iterator::Flex::Zip; | |||||||||
| 636 | 13 | Iterator::Flex::Zip->new( @args ); | |||||||||
| 637 | } | ||||||||||
| 638 | |||||||||||
| 639 | |||||||||||
| 640 | |||||||||||
| 641 | |||||||||||
| 642 | |||||||||||
| 643 | |||||||||||
| 644 | |||||||||||
| 645 | |||||||||||
| 646 | |||||||||||
| 647 | |||||||||||
| 648 | |||||||||||
| 649 | |||||||||||
| 650 | 21 | ▶ | sub thaw ( $frozen, $pars = {} ) { | ||||||||
|
Subroutine
thaw: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||
| 651 | |||||||||||
| 652 | 21 | my @steps = $frozen->@*; | |||||||||
| 653 | |||||||||||
| 654 | # parent data and iterator state is last | ||||||||||
| 655 | 21 | my $exhausted = pop @steps; | |||||||||
| 656 | 21 | my $parent = pop @steps; | |||||||||
| 657 | |||||||||||
| 658 | 21 | my @depends = map { thaw( $_ ) } @steps; | |||||||||
| 659 | |||||||||||
| 660 | 21 | my ( $package, $state ) = @$parent; | |||||||||
| 661 | |||||||||||
| 662 | 21 | ▶ | throw_failure( parameter => "state argument for $package constructor must be a HASH reference" ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 663 | unless is_hashref( $state ); | ||||||||||
| 664 | |||||||||||
| 665 | 21 | require_module( $package ); | |||||||||
| 666 | 21 | ▶ | my $new_from_state = $package->can( 'new_from_state' ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 667 | or | ||||||||||
| 668 | throw_failure( parameter => "unable to thaw: $package doesn't provide 'new_from_state' method" ); | ||||||||||
| 669 | |||||||||||
| 670 | $state->{depends} = \@depends | ||||||||||
| 671 | 21 | ▶ | if @depends; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 672 | |||||||||||
| 673 | 21 | $state->{thaw} = 1; | |||||||||
| 674 | |||||||||||
| 675 | 21 | my $iter = $package->$new_from_state( $state, $pars ); | |||||||||
| 676 | 21 | ▶ | $exhausted ? $iter->set_exhausted : $iter->_clear_state; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 677 | 21 | return $iter; | |||||||||
| 678 | } | ||||||||||
| 679 | |||||||||||
| 680 | 26 | 1; | |||||||||
| 681 | |||||||||||
| 682 | # | ||||||||||
| 683 | # This file is part of Iterator-Flex | ||||||||||
| 684 | # | ||||||||||
| 685 | # This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory. | ||||||||||
| 686 | # | ||||||||||
| 687 | # This is free software, licensed under: | ||||||||||
| 688 | # | ||||||||||
| 689 | # The GNU General Public License, Version 3, June 2007 | ||||||||||
| 690 | # | ||||||||||
| 691 | |||||||||||
| 692 | __END__ | ||||||||||