| 1 | package POE::Component::Client::Bayeux::Transport; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Params::Validate; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use POE qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | Component::Client::Bayeux::Transport::LongPolling | ||||||||||||||||||||||||||||
| 9 | 3 | ); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 3 | my $child_counter = 0; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub spawn { | ||||||||||||||||||||||||||
|
Subroutine
spawn: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 15 | 0 | my %args = validate(@_, { | |||||||||||||||||||||||||||
| 16 | type => 1, | ||||||||||||||||||||||||||||
| 17 | parent => 1, | ||||||||||||||||||||||||||||
| 18 | parent_heap => 1, | ||||||||||||||||||||||||||||
| 19 | }); | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # TODO: support more than one transport | ||||||||||||||||||||||||||||
| 22 | die "Support only long-polling at the moment" | ||||||||||||||||||||||||||||
| 23 | 0 | ▶ | unless $args{type} eq 'long-polling'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | my $package = 'POE::Component::Client::Bayeux::Transport::LongPolling'; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | my @extra_states = $package->extra_states(); | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | my $session = POE::Session->create( | ||||||||||||||||||||||||||||
| 30 | inline_states => { | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | _start => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 32 | 0 | my ($kernel, $heap) = @_[KERNEL, HEAP]; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | $heap->{alias} = __PACKAGE__ . '_' . $child_counter++; | |||||||||||||||||||||||||||
| 35 | 0 | $kernel->alias_set($heap->{alias}); | |||||||||||||||||||||||||||
| 36 | }, | ||||||||||||||||||||||||||||
| 37 | 0 | ▶ | _stop => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 38 | 0 | my ($kernel, $heap) = @_[KERNEL, HEAP]; | |||||||||||||||||||||||||||
| 39 | 0 | $kernel->alias_remove($heap->{alias}); | |||||||||||||||||||||||||||
| 40 | }, | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | shutdown => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 42 | 0 | my ($kernel, $heap) = @_[KERNEL, HEAP]; | |||||||||||||||||||||||||||
| 43 | 0 | $kernel->alias_remove($heap->{alias}); | |||||||||||||||||||||||||||
| 44 | }, | ||||||||||||||||||||||||||||
| 45 | }, | ||||||||||||||||||||||||||||
| 46 | package_states => [ | ||||||||||||||||||||||||||||
| 47 | $package => [ | ||||||||||||||||||||||||||||
| 48 | qw( | ||||||||||||||||||||||||||||
| 49 | check startup sendMessages deliver disconnect | ||||||||||||||||||||||||||||
| 50 | tunnelCollapse tunnelInit | ||||||||||||||||||||||||||||
| 51 | ), | ||||||||||||||||||||||||||||
| 52 | @extra_states | ||||||||||||||||||||||||||||
| 53 | ], | ||||||||||||||||||||||||||||
| 54 | ], | ||||||||||||||||||||||||||||
| 55 | heap => { | ||||||||||||||||||||||||||||
| 56 | %args, | ||||||||||||||||||||||||||||
| 57 | }, | ||||||||||||||||||||||||||||
| 58 | ($ENV{POE_DEBUG} ? ( | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | options => { trace => 1, debug => 1 }, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | ) : ()), | ||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | return $session->ID; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | # Placeholder methods for child transports | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | ▶ | sub extra_states { | ||||||||||||||||||||||||||
|
Subroutine
extra_states: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub check { | ||||||||||||||||||||||||||
|
Subroutine
check: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub startup { | ||||||||||||||||||||||||||
|
Subroutine
startup: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub sendMessages { | ||||||||||||||||||||||||||
|
Subroutine
sendMessages: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub deliver { | ||||||||||||||||||||||||||
|
Subroutine
deliver: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub disconnect { | ||||||||||||||||||||||||||
|
Subroutine
disconnect: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub tunnelCollapse { | ||||||||||||||||||||||||||
|
Subroutine
tunnelCollapse: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub tunnelInit { | ||||||||||||||||||||||||||
|
Subroutine
tunnelInit: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 84 | 0 | my ($kernel, $heap) = @_[KERNEL, HEAP]; | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if (! $heap->{parent_heap}{_initialized} || $heap->{parent_heap}{_connected}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $heap->{"parent_heap"}{"_initialized"} or $heap->{"parent_heap"}{"_connected"}
MC/DC0%0/2
not $heap->{"parent_heap"}{"_initialized"} or $heap->{"parent_heap"}{"_connected"}
not $heap->{"parent_heap"}{"_initialized"}
$heap->{"parent_heap"}{"_connected"}
Truth table0%0/3
not(A) or B
A= not $heap->{"parent_heap"}{"_initialized"}B= $heap->{"parent_heap"}{"_connected"}
| |||||||||||||||||||||||||||||
| 87 | 0 | die "Attempting connect() when already connected or not initalized"; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 3 | 1; | |||||||||||||||||||||||||||