| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
8
|
|
|
8
|
|
40
|
use strict; |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
272
|
|
|
2
|
8
|
|
|
8
|
|
28
|
use warnings; |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
466
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Time::Out::ParamConstraints; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# keeping the following $VERSION declaration on a single line is important |
|
7
|
|
|
|
|
|
|
#<<< |
|
8
|
8
|
|
|
8
|
|
34
|
use version 0.9915; our $VERSION = version->declare( '1.0.0' ); |
|
|
8
|
|
|
|
|
111
|
|
|
|
8
|
|
|
|
|
37
|
|
|
9
|
|
|
|
|
|
|
#>>> |
|
10
|
|
|
|
|
|
|
|
|
11
|
8
|
|
|
8
|
|
647
|
use Exporter qw( import ); |
|
|
8
|
|
|
|
|
59
|
|
|
|
8
|
|
|
|
|
327
|
|
|
12
|
8
|
|
|
8
|
|
36
|
use Scalar::Util qw( blessed looks_like_number reftype ); |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
3606
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw( assert_NonNegativeNumber assert_CodeRef ); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _is_CodeRef ( $ ); |
|
17
|
|
|
|
|
|
|
sub _is_String ( $ ); |
|
18
|
|
|
|
|
|
|
sub _croakf ( $@ ); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub assert_NonNegativeNumber( $ ) { |
|
21
|
20
|
|
|
20
|
0
|
61
|
my ( $value ) = @_; |
|
22
|
|
|
|
|
|
|
|
|
23
|
20
|
50
|
33
|
|
|
69
|
_is_String $value |
|
24
|
|
|
|
|
|
|
&& looks_like_number $value |
|
25
|
|
|
|
|
|
|
&& $value !~ /\A (?: Inf (?: inity )? | NaN ) \z/xi |
|
26
|
|
|
|
|
|
|
&& $value >= 0 ? return $value : _croakf 'value is not a non-negative number'; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub assert_CodeRef( $ ) { |
|
30
|
20
|
|
|
20
|
0
|
47
|
my ( $value ) = @_; |
|
31
|
|
|
|
|
|
|
|
|
32
|
20
|
50
|
|
|
|
59
|
_is_CodeRef $value ? return $value : _croakf 'value is not a code reference'; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _is_CodeRef( $ ) { |
|
36
|
20
|
|
|
20
|
|
46
|
my ( $value ) = @_; |
|
37
|
|
|
|
|
|
|
|
|
38
|
20
|
|
33
|
|
|
147
|
return !defined blessed $value && ref $value eq 'CODE'; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _is_String( $ ) { |
|
42
|
20
|
|
|
20
|
|
44
|
my ( $value ) = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
20
|
|
33
|
|
|
444
|
return defined $value && reftype \$value eq 'SCALAR'; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _croakf( $@ ) { |
|
48
|
|
|
|
|
|
|
# load Carp lazily |
|
49
|
0
|
|
|
0
|
|
|
require Carp; |
|
50
|
0
|
0
|
|
|
|
|
@_ = ( ( @_ == 1 ? shift : sprintf shift, @_ ) . ', stopped' ); |
|
51
|
0
|
|
|
|
|
|
goto &Carp::croak; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |