WebSocket/X/ReceivedClose.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 35 CC 4 SCAR 24.0
CC
4
Cov
0%
_new
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 11.0
1 package Net::WebSocket::X::ReceivedClose;
2  
3 use strict;
4 use warnings;
5  
6 use parent qw( Net::WebSocket::X::Base );
7  
8 use Net::WebSocket::Constants ();
9  
10 sub _new {
11 my ($class, $frame) = @_;
12  
13 my $txt;
14 if ( my @code_reason = $frame->get_code_and_reason() ) {
15 my $status_name = Net::WebSocket::Constants::status_code_to_name($code_reason[0]);
16 if ($status_name) {
17 $code_reason[0] .= "/$status_name";
18 }
19  
20 pop @code_reason if !length $code_reason[1];
21  
22 $txt = "Received close frame: [@code_reason]";
23 }
24 else {
25 $txt = "Received close frame (empty)";
26 }
27  
28 return $class->SUPER::_new( $txt, frame => $frame );
29 }
30  
31 1;