line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::PObject::Type; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Type.pm,v 1.6 2004/05/19 06:07:52 sherzodr Exp |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
92
|
|
6
|
|
|
|
|
|
|
#use diagnostics; |
7
|
3
|
|
|
3
|
|
22
|
use vars ('$VERSION', '@ISA'); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
225
|
|
8
|
|
|
|
|
|
|
use overload ( |
9
|
|
|
|
|
|
|
'""' => 'id', |
10
|
0
|
0
|
|
0
|
|
0
|
bool => sub { shift->{id} ? 1 : 0 }, |
11
|
3
|
|
|
|
|
30
|
fallback => 1 |
12
|
3
|
|
|
3
|
|
16
|
); |
|
3
|
|
|
|
|
5
|
|
13
|
3
|
|
|
3
|
|
246
|
use Carp; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
1981
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$VERSION = '1.03'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# meant to be overwritten |
27
|
|
|
|
|
|
|
sub _init { |
28
|
32
|
|
|
32
|
|
72
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
35
|
|
|
35
|
0
|
59
|
my $class = shift; |
41
|
35
|
|
33
|
|
|
166
|
$class = ref($class) || $class; |
42
|
|
|
|
|
|
|
|
43
|
35
|
|
|
|
|
115
|
my $self = { @_ }; |
44
|
|
|
|
|
|
|
|
45
|
35
|
|
|
|
|
74
|
bless $self, $class; |
46
|
35
|
|
|
|
|
133
|
$self->_init(); |
47
|
35
|
|
|
|
|
173
|
return $self |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub id { |
53
|
172
|
|
|
172
|
0
|
227
|
my $self = shift; |
54
|
172
|
|
|
|
|
2195
|
return $self->{id} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub load { |
61
|
79
|
|
|
79
|
0
|
116
|
my $class = shift; |
62
|
79
|
|
33
|
|
|
318
|
$class = ref($class) || $class; |
63
|
79
|
|
|
|
|
1296
|
return bless { id=>$_[0], args=>$_[1] }, $class |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub dump { |
70
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
0
|
require Data::Dumper; |
73
|
0
|
|
|
|
|
0
|
my $d = Data::Dumper->new([$self], [ref $self]); |
74
|
0
|
|
|
|
|
0
|
$d->Indent(2); |
75
|
0
|
|
|
|
|
0
|
return $d->Dump() |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# member functions for each column type |
82
|
|
|
|
|
|
|
sub substr { |
83
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
84
|
1
|
50
|
|
|
|
4
|
unless ( @_ ) { |
85
|
0
|
|
|
|
|
0
|
croak "$self->substr(): usage error"; |
86
|
|
|
|
|
|
|
} |
87
|
1
|
50
|
|
|
|
3
|
return unless defined $self->id(); |
88
|
1
|
|
|
|
|
3
|
return CORE::substr($self->id, $_[0], $_[1]) |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub ucfirst { |
94
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
95
|
|
|
|
|
|
|
|
96
|
1
|
50
|
|
|
|
5
|
if ( @_ ) { |
97
|
0
|
|
|
|
|
0
|
croak "$self->ucfirst(): usage error"; |
98
|
|
|
|
|
|
|
} |
99
|
1
|
50
|
|
|
|
5
|
return unless defined $self->id(); |
100
|
1
|
|
|
|
|
3
|
return CORE::ucfirst( $self->id ); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub lcfirst { |
106
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
107
|
|
|
|
|
|
|
|
108
|
1
|
50
|
|
|
|
5
|
if ( @_ ) { |
109
|
0
|
|
|
|
|
0
|
croak "$self->lcfirst(): usage error"; |
110
|
|
|
|
|
|
|
} |
111
|
1
|
50
|
|
|
|
3
|
return unless defined $self->id(); |
112
|
1
|
|
|
|
|
4
|
return CORE::lcfirst( $self->id ); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub lc { |
118
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
119
|
|
|
|
|
|
|
|
120
|
1
|
50
|
|
|
|
3
|
if ( @_ ) { |
121
|
0
|
|
|
|
|
0
|
croak "$self->lc(): usage error"; |
122
|
|
|
|
|
|
|
} |
123
|
1
|
50
|
|
|
|
4
|
return unless defined $self->id(); |
124
|
1
|
|
|
|
|
3
|
return CORE::lc( $self->id ); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub uc { |
130
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
131
|
|
|
|
|
|
|
|
132
|
1
|
50
|
|
|
|
5
|
if ( @_ ) { |
133
|
0
|
|
|
|
|
0
|
croak "$self->uc(): usage error"; |
134
|
|
|
|
|
|
|
} |
135
|
1
|
50
|
|
|
|
4
|
return unless defined $self->id(); |
136
|
1
|
|
|
|
|
4
|
return CORE::uc( $self->id ); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |
142
|
|
|
|
|
|
|
__END__ |