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