line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################################################### |
2
|
|
|
|
|
|
|
### Trinket::DataType::default |
3
|
|
|
|
|
|
|
### |
4
|
|
|
|
|
|
|
### Default object datatype handler |
5
|
|
|
|
|
|
|
### |
6
|
|
|
|
|
|
|
### $Id: Object.pm,v 1.3 2001/02/19 20:01:53 deus_x Exp $ |
7
|
|
|
|
|
|
|
### |
8
|
|
|
|
|
|
|
### TODO: |
9
|
|
|
|
|
|
|
### |
10
|
|
|
|
|
|
|
### |
11
|
|
|
|
|
|
|
########################################################################### |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Trinket::DataType::default; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
BEGIN { |
16
|
3
|
|
|
3
|
|
7
|
our $VERSION = "0.0"; |
17
|
3
|
|
|
|
|
197
|
our @ISA = qw( Trinket::DataType ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
100
|
|
21
|
3
|
|
|
3
|
|
14
|
no warnings qw( uninitialized ); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
111
|
|
22
|
3
|
|
|
3
|
|
14
|
use Trinket::Object; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
669
|
|
23
|
3
|
|
|
3
|
|
1891
|
use Trinket::DataType; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
1050
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub set { |
26
|
857
|
|
|
857
|
0
|
1995
|
my ($pkg, $self, $name, $val) = @_; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
### If there is no change in values, do nothing. |
29
|
857
|
100
|
|
|
|
3234
|
return $val if ($val eq $self->[OBJ_PROPS]->{$name}->[PROP_VALUE]); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
### If this property isn't dirty already, save the clean value and |
32
|
|
|
|
|
|
|
### then flag it as dirty. |
33
|
848
|
100
|
66
|
|
|
5683
|
if ( (! $self->[OBJ_PROPS]->{$name}->[PROP_DIRTY]) && |
|
|
|
66
|
|
|
|
|
34
|
|
|
|
|
|
|
(! ($name eq 'class') || ($name eq 'directory') ) ) { |
35
|
|
|
|
|
|
|
|
36
|
720
|
|
|
|
|
5044
|
$self->[OBJ_PROPS]->{$name}->[PROP_CLEAN_VALUE] = |
37
|
|
|
|
|
|
|
$self->[OBJ_PROPS]->{$name}->[PROP_VALUE]; |
38
|
720
|
|
|
|
|
2534
|
$self->[OBJ_PROPS]->{$name}->[PROP_DIRTY] = 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
### Finally, set the new value. |
42
|
848
|
|
|
|
|
4412
|
return $self->[OBJ_PROPS]->{$name}->[PROP_VALUE] = $val; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub get { |
46
|
1819
|
|
|
1819
|
0
|
3684
|
my ($pkg, $self, $name) = @_; |
47
|
|
|
|
|
|
|
|
48
|
1819
|
|
|
|
|
14062
|
return $self->[OBJ_PROPS]->{$name}->[PROP_VALUE]; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |