line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::WebSocket::Message; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
100438
|
use strict; |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
113
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
86
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
689
|
use Call::Context (); |
|
4
|
|
|
|
|
614
|
|
|
4
|
|
|
|
|
830
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
10
|
50
|
|
10
|
0
|
72
|
if (!$_[1]->isa('Net::WebSocket::Frame')) { |
10
|
0
|
|
|
|
|
0
|
die( (caller 0)[3] . ' needs at least one Net::WebSocket::Frame object!' ); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
10
|
|
|
|
|
45
|
return bless \@_, shift; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub get_frames { |
17
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
Call::Context::must_be_list(); |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
return @$self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub get_payload { |
25
|
14
|
|
|
14
|
0
|
143
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
|
27
|
14
|
|
|
|
|
42
|
return join( q<>, map { $_->get_payload() } @$self ); |
|
17
|
|
|
|
|
63
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub to_bytes { |
31
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
return join( q<>, map { $_->to_bytes() } @$self ); |
|
0
|
|
|
|
|
0
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
37
|
|
|
|
|
|
|
# Static function that auto-loads the actual message class. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub create_from_frames { |
40
|
10
|
|
|
10
|
0
|
62
|
my $type = $_[0]->get_type(); |
41
|
|
|
|
|
|
|
|
42
|
10
|
|
|
|
|
29
|
my $class = __PACKAGE__ . "::$type"; |
43
|
10
|
100
|
|
|
|
80
|
if (!$class->can('new')) { |
44
|
5
|
|
|
|
|
18
|
Module::Load::load($class); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
10
|
|
|
|
|
99
|
return $class->new(@_); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |