line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::BoundedInteger; |
2
|
1
|
|
|
1
|
|
777
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
222
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.005'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub TIESCALAR { |
9
|
0
|
|
|
0
|
|
|
my $class = shift; |
10
|
0
|
|
|
|
|
|
my $value = shift; |
11
|
0
|
|
|
|
|
|
my $max = shift; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
my $self = bless [ 0, $max ], $class; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
$self->STORE( $value ); |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
|
|
sub FETCH { $_[0]->[0] } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub STORE { |
23
|
0
|
|
|
0
|
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
my $value = shift; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $magnitude = abs $value; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
0
|
|
|
|
croak( "The [$value] exceeds the allowed limit [$self->[1]]" ) |
29
|
|
|
|
|
|
|
if( int($value) != $value || $magnitude > $self->[1] ); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$self->[0] = $value; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$value; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |