| 1 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package Crypt::Random::Provider::File; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use Math::Pari qw(pari2num); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Fcntl; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | our $VERSION = '1.57'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub _defaultsource { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_defaultsource: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1701 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1701 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1701 | ▶ | my $self = { Source => $args{File} || $args{Device} || $args{Filename} || $class->_defaultsource() }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
$args{'File'} || $args{'Device'} || $args{'Filename'} || $class->_defaultsource
$args{"File"} or $args{"Device"} or $args{"Filename"}
$args{"File"} or $args{"Device"}
MC/DC0%0/4
$args{'File'} || $args{'Device'} || $args{'Filename'} || $class->_defaultsource
$args{"File"}
$args{"Device"}
$args{"Filename"}
$class->_defaultsource
Truth table20%1/5
A or B or C || D
A= $args{"File"}B= $args{"Device"}C= $args{"Filename"}D= $class->_defaultsource
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1701 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1701 | ▶ | sub get_data { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_data: called CC=11 SCAR=27.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1701 | my ($self, %params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1701 | ▶ | $self = {} unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1701 | my $size = $params{Size}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1701 | ▶ | my $skip = $params{Skip} || $$self{Skip} || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$params{'Skip'} || $self->{'Skip'} || ''
$params{"Skip"} or $self->{"Skip"}
MC/DC0%0/2
$params{'Skip'} || $self->{'Skip'} || ''
$params{"Skip"}
$self->{"Skip"}
Truth table33%1/3
A or B
A= $params{"Skip"}B= $self->{"Skip"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1701 | my $q_skip = quotemeta($skip); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1701 | ▶ | if ($size && ref $size eq "Math::Pari") { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$size and ref $size eq "Math::Pari"
MC/DC0%0/2
$size and ref $size eq "Math::Pari"
$size
ref $size eq "Math::Pari"
Truth table33%1/3
A and B
A= $sizeB= ref $size eq "Math::Pari"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $size = pari2num($size); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1701 | ▶ | my $bytes = $params{Length} || (int($size / 8) + 1); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$params{'Length'} || int($size / 8) + 1
MC/DC0%0/2
$params{'Length'} || int($size / 8) + 1
$params{'Length'}
int($size / 8) + 1
Truth table33%1/3
A || B
A= $params{'Length'}B= int($size / 8) + 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1701 | sysopen RANDOM, $$self{Source}, O_RDONLY; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1701 | my($r, $read, $rt) = ('', 0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1701 | ▶ | while ($read < $bytes) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1701 | my $howmany = sysread RANDOM, $rt, $bytes - $read; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1701 | ▶ | next unless $howmany; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1701 | ▶ | if ($howmany == -1) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | croak "Error while reading from $$self{Source}. $!" | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1701 | ▶ | $rt =~ s/[$q_skip]//g if $skip; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1701 | $r .= $rt; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1701 | $read = length $r; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1701 | $r; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 704 | ▶ | sub available { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
available: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 704 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 704 | return -e $class->_defaultsource(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||