| 1 | package Net::WebSocket::PMCE::Data; | ||
| 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 | =encoding utf-8 | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Net::WebSocket::PMCE::Data - Base class for PMCE data modules. | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | =head1 METHODS | ||
| 15 | |||
| 16 | Available on all instances: | ||
| 17 | |||
| 18 | =head2 I<OBJ>->message_is_compressed( MESSAGE ) | ||
| 19 | |||
| 20 | MESSAGE is an instance of L<Net::WebSocket::Message>. | ||
| 21 | The output is a Perl boolean that indicates whether the message | ||
| 22 | appears to be PMCE-compressed. | ||
| 23 | |||
| 24 | You can also call this as a class method, e.g.: | ||
| 25 | |||
| 26 | Net::WebSocket::PMCE->message_is_compressed( $message_obj ); | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | 0 | ▶ | sub message_is_compressed { |
|
Subroutine
message_is_compressed: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 31 | 0 | return ($_[1]->get_frames())[0]->has_rsv1(); | |
| 32 | } | ||
| 33 | |||
| 34 | #There is no frame_is_compressed() because compression | ||
| 35 | #is only supposed to apply to messages. | ||
| 36 | |||
| 37 | =head2 INITIAL_FRAME_RSV() | ||
| 38 | |||
| 39 | Returns the numeric value of the RSV bits for PMCEs, | ||
| 40 | suitable for giving to a L<Net::WebSocket::Frame> subclass’s | ||
| 41 | constructor. | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | 3 | ▶ | use constant { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 46 | 3 | INITIAL_FRAME_RSV => 0b100, #RSV1 | |
| 47 | 3 | }; | |
| 48 | |||
| 49 | 3 | 1; | |