| 1 | package Net::UCP::IntTimeout; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | ▶ | use 5.008007; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 1 | require Exporter; | |||||||||||||
| 8 | |||||||||||||||
| 9 | 1 | our @ISA = qw(Exporter); | |||||||||||||
| 10 | 1 | our @EXPORT = qw(); | |||||||||||||
| 11 | |||||||||||||||
| 12 | 1 | our $VERSION = '0.05'; | |||||||||||||
| 13 | |||||||||||||||
| 14 | 1 | ▶ | use constant MIN_TIMEOUT => 0; # No timeout at all! | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 15 | 1 | ▶ | use constant DEFAULT_TIMEOUT => 15; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 16 | 1 | ▶ | use constant MAX_TIMEOUT => 60; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 17 | |||||||||||||||
| 18 | 0 | ▶ | sub new { bless({}, shift())->_init(@_); } | ||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 19 | |||||||||||||||
| 20 | 0 | ▶ | sub _init { | ||||||||||||
|
Subroutine
_init: not called CC=2 SCAR=17.9
| |||||||||||||||
| 21 | 0 | my $self = shift; | |||||||||||||
| 22 | 0 | my %opt = @_; | |||||||||||||
| 23 | |||||||||||||||
| 24 | 0 | ▶ | $self->set($opt{timeout}) if (exists $opt{timeout}); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 25 | 0 | return $self; | |||||||||||||
| 26 | } | ||||||||||||||
| 27 | |||||||||||||||
| 28 | 0 | ▶ | sub set { | ||||||||||||
|
Subroutine
set: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||
| 29 | 0 | my $self = shift; | |||||||||||||
| 30 | 0 | ▶ | my $timeout = shift || DEFAULT_TIMEOUT; | ||||||||||||
|
Condition0%0/2
shift() || 15
MC/DC0%0/1
shift() || 15
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||
| 31 | |||||||||||||||
| 32 | 0 | ▶ | if ($timeout > MAX_TIMEOUT) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 33 | 0 | $timeout = MAX_TIMEOUT; | |||||||||||||
| 34 | } | ||||||||||||||
| 35 | elsif ($timeout < MIN_TIMEOUT) { | ||||||||||||||
| 36 | 0 | $timeout = MIN_TIMEOUT; | |||||||||||||
| 37 | } | ||||||||||||||
| 38 | |||||||||||||||
| 39 | 0 | return $self->{timeout} = $timeout; | |||||||||||||
| 40 | } | ||||||||||||||
| 41 | |||||||||||||||
| 42 | 0 | ▶ | sub get { | ||||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 43 | 0 | my $self = shift; | |||||||||||||
| 44 | 0 | return $self->{timeout}; | |||||||||||||
| 45 | } | ||||||||||||||
| 46 | |||||||||||||||
| 47 | 1 | 1; | |||||||||||||
| 48 | __END__ | ||||||||||||||