| 1 | package Games::TF2::Demo::Iterator; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use v5.26; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use feature 'signatures'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 11 | ▶ | no warnings 'experimental::signatures'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 11 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 11 | ▶ | use Object::Pad 0.800; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 11 | ▶ | use Games::TF2::Demo::Handler; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | # Collects the items of the wired callbacks into the iterator's queue. | ||||||||||||||||||||||||||||
| 15 | class Games::TF2::Demo::Iterator::Collector :does(Games::TF2::Demo::Handler) :strict(params) { | ||||||||||||||||||||||||||||
| 16 | 11 | field $queue :param; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | method on_tick ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_tick: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | method on_game_event ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_game_event: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | method on_user_message ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_user_message: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | method on_entity ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_entity: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | method on_temp_entity ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_temp_entity: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | method on_string_table_changed ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_string_table_changed: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | method on_console_command ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_console_command: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | method on_sound ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_sound: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | method on_message ($item) { push $queue->@*, $item } | ||||||||||||||||||||||||||
|
Subroutine
on_message: not called CC=1 SCAR=4.6
| |||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 11 | class Games::TF2::Demo::Iterator :strict(params) { | |||||||||||||||||||||||||||
| 30 | 11 | field $demo :param; | |||||||||||||||||||||||||||
| 31 | 11 | field $mask :param; | |||||||||||||||||||||||||||
| 32 | 11 | field @queue; | |||||||||||||||||||||||||||
| 33 | 11 | field $collector; | |||||||||||||||||||||||||||
| 34 | field $ended = 0; | ||||||||||||||||||||||||||||
| 35 | 0 | field $exhausted :reader = 0; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | ADJUST { | ||||||||||||||||||||||||||
|
Subroutine
exhausted: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | $collector = Games::TF2::Demo::Iterator::Collector->new( queue => \@queue ); | ||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | method next () { | ||||||||||||||||||||||||||
|
Subroutine
next: not called CC=4 SCAR=28.6
Pod
documented
| |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | while ( !@queue && !$ended ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@queue or $ended
MC/DC0%0/2
@queue or $ended
@queue
$ended
Truth table0%0/3
A or B
A= @queueB= $ended
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | # A step that throws leaves the iterator ended and exhausted. | ||||||||||||||||||||||||||||
| 45 | 0 | $ended = $exhausted = 1; | |||||||||||||||||||||||||||
| 46 | 0 | $ended = !$demo->_step_for_iterator( $collector, $mask ); | |||||||||||||||||||||||||||
| 47 | 0 | $exhausted = 0; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | return shift @queue if @queue; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | $exhausted = 1; | |||||||||||||||||||||||||||
| 51 | 0 | return undef; | |||||||||||||||||||||||||||
| 52 | 11 | } | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 11 | 1; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | __END__ | ||||||||||||||||||||||||||||