| 1 | package Net::WebSocket::Message; | ||||||||||
| 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 | |||||||||||
| 6 | 3 | ▶ | use Call::Context (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub new { | ||||||||||
| 9 | 5 | ▶ | if (!$_[1]->isa('Net::WebSocket::Frame')) { | ||||||||
|
Subroutine
new: called CC=2 SCAR=8.1
Pod
undocumented
Branch: 1 branch
| |||||||||||
| 10 | 0 | die( (caller 0)[3] . ' needs at least one Net::WebSocket::Frame object!' ); | |||||||||
| 11 | } | ||||||||||
| 12 | |||||||||||
| 13 | 5 | return bless \@_, shift; | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | sub get_frames { | ||||||||||
| 17 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
get_frames: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 18 | |||||||||||
| 19 | 0 | Call::Context::must_be_list(); | |||||||||
| 20 | |||||||||||
| 21 | 0 | return @$self; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | sub get_payload { | ||||||||||
| 25 | 4 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
get_payload: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 26 | |||||||||||
| 27 | 4 | return join( q<>, map { $_->get_payload() } @$self ); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | sub to_bytes { | ||||||||||
| 31 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
to_bytes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 32 | |||||||||||
| 33 | 0 | return join( q<>, map { $_->to_bytes() } @$self ); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | #---------------------------------------------------------------------- | ||||||||||
| 37 | # Static function that auto-loads the actual message class. | ||||||||||
| 38 | |||||||||||
| 39 | sub create_from_frames { | ||||||||||
| 40 | 5 | ▶ | my $type = $_[0]->get_type(); | ||||||||
|
Subroutine
create_from_frames: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | |||||||||||
| 42 | 5 | my $class = __PACKAGE__ . "::$type"; | |||||||||
| 43 | 5 | ▶ | if (!$class->can('new')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 2 | Module::Load::load($class); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 5 | return $class->new(@_); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 3 | 1; | |||||||||