| 1 | package Net::WebSocket::X::BadHTTPStatus; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Net::WebSocket::Constants (); | ||
| 7 | |||
| 8 | use parent qw( Net::WebSocket::X::Base ); | ||
| 9 | |||
| 10 | sub _new { | ||
| 11 | my ($class, $code, $reason) = @_; | ||
| 12 | |||
| 13 | my $str = "Received invalid HTTP status: $code"; | ||
| 14 | $str .= " ($reason)" if defined $reason; | ||
| 15 | |||
| 16 | $str .= " - must be " . Net::WebSocket::Constants::REQUIRED_HTTP_STATUS(); | ||
| 17 | |||
| 18 | return $class->SUPER::_new( | ||
| 19 | $str, | ||
| 20 | code => $code, | ||
| 21 | reason => $reason, | ||
| 22 | ); | ||
| 23 | } | ||
| 24 | |||
| 25 | 1; |