line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::WebSocket::Message; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
112088
|
use strict; |
|
4
|
|
|
|
|
25
|
|
|
4
|
|
|
|
|
94
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
84
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
663
|
use Call::Context (); |
|
4
|
|
|
|
|
594
|
|
|
4
|
|
|
|
|
827
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
10
|
50
|
|
10
|
0
|
70
|
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
|
|
|
|
|
41
|
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
|
12
|
|
|
12
|
0
|
143
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
|
27
|
12
|
|
|
|
|
32
|
return join( q<>, map { $_->get_payload() } @$self ); |
|
15
|
|
|
|
|
56
|
|
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
|
52
|
my $type = $_[0]->get_type(); |
41
|
|
|
|
|
|
|
|
42
|
10
|
|
|
|
|
30
|
my $class = __PACKAGE__ . "::$type"; |
43
|
10
|
100
|
|
|
|
75
|
if (!$class->can('new')) { |
44
|
5
|
|
|
|
|
17
|
Module::Load::load($class); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
10
|
|
|
|
|
89
|
return $class->new(@_); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |