File Coverage

blib/lib/Net/WebSocket/PMCE/Data.pm
Criterion Covered Total %
statement 9 10 90.0
branch n/a
condition n/a
subroutine 3 4 75.0
pod 1 1 100.0
total 13 15 86.6


line stmt bran cond sub pod time code
1             package Net::WebSocket::PMCE::Data;
2              
3 3     3   962 use strict;
  3         6  
  3         70  
4 3     3   13 use warnings;
  3         6  
  3         189  
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->message_is_compressed( MESSAGE )
19              
20             MESSAGE is an instance of L.
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             sub message_is_compressed {
31 0     0 1   return ($_[1]->get_frames())[0]->has_rsv1();
32             }
33              
34             =head2 INITIAL_FRAME_RSV()
35              
36             Returns the numeric value of the RSV bits for PMCEs,
37             suitable for giving to a L subclass’s
38             constructor.
39              
40             =cut
41              
42             use constant {
43 3         232 INITIAL_FRAME_RSV => 0b100, #RSV1
44 3     3   14 };
  3         5  
45              
46             1;