| 1 | package Unblock::WebSocket::_Random; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 23 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 23 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 23 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 23 | ▶ | use Unblock::WebSocket (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | sub bytes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bytes: called CC=6 SCAR=23.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | my ($class, $length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | croak 'bytes(): length must be a positive integer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $length and not ref $length and $length =~ /\A[0-9]+\z/ and $length > 0
defined $length and not ref $length and $length =~ /\A[0-9]+\z/
defined $length and not ref $length
MC/DC0%0/4
defined $length and not ref $length and $length =~ /\A[0-9]+\z/ and $length > 0
defined $length
not ref $length
$length =~ /\A[0-9]+\z/
$length > 0
Truth table20%1/5
A and not(B) and C and D
A= defined $lengthB= not ref $lengthC= $length =~ /\A[0-9]+\z/D= $length > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | unless defined($length) && !ref($length) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | && $length =~ /\A[0-9]+\z/ && $length > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | ▶ | if (Unblock::WebSocket->native_available) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | require Unblock::WebSocket::_Native; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | return Unblock::WebSocket::_Native->_random_bytes($length); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | require Crypt::SysRandom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | return Crypt::SysRandom::random_bytes($length); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub mask_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mask_key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | return $class->bytes(4); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 23 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||