line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::Object; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
5091
|
use Data::Dumper; |
|
1
|
|
|
|
|
26607
|
|
|
1
|
|
|
|
|
315
|
|
5
|
1
|
|
|
1
|
|
10
|
use vars qw[$AUTOLOAD $VERSION ]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1168
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.0.2'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# This is the base object class for all objects. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# --------- |
12
|
|
|
|
|
|
|
sub new { |
13
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
14
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $self = { }; |
17
|
0
|
|
|
|
|
|
bless($self, $class); |
18
|
0
|
|
|
|
|
|
return $self->init(@_); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# --------- |
23
|
|
|
|
|
|
|
sub init { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
0
|
|
|
|
|
|
foreach (@_) { @{%{$self}}{keys %{$_}} = values %{$_}; } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# --------- |
31
|
|
|
|
|
|
|
sub copy { |
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
33
|
0
|
|
|
|
|
|
return $self->deserialize(); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# --------- |
38
|
|
|
|
|
|
|
sub description { |
39
|
0
|
|
|
0
|
0
|
|
my $dataDumper = Data::Dumper->new([+shift, ]); |
40
|
0
|
|
|
|
|
|
$dataDumper->Purity(1)->Deepcopy(1)->Terse(1)->Indent(1); |
41
|
0
|
|
|
|
|
|
return $dataDumper->Dump(); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# --------- |
46
|
|
|
|
|
|
|
sub serialize { |
47
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
48
|
0
|
0
|
|
|
|
|
my $anObject = ref($proto) |
49
|
|
|
|
|
|
|
? $proto |
50
|
|
|
|
|
|
|
: shift; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $dataDumper = Data::Dumper->new([$anObject, ]); |
53
|
0
|
|
|
|
|
|
$dataDumper->Purity(1)->Deepcopy(1)->Terse(1)->Indent(0); |
54
|
0
|
|
|
|
|
|
return $dataDumper->Dump(); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# --------- |
59
|
|
|
|
|
|
|
sub deserialize { |
60
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
61
|
0
|
0
|
|
|
|
|
my $aDescription = ref($proto) |
62
|
|
|
|
|
|
|
? $proto->serialize() |
63
|
|
|
|
|
|
|
: shift; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return eval $aDescription; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# --------- |
70
|
|
|
|
|
|
|
sub class { |
71
|
0
|
|
|
0
|
0
|
|
return ref(+shift); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# --------- |
76
|
|
|
|
|
|
|
sub delete { |
77
|
0
|
|
|
0
|
0
|
|
undef %{; shift}; |
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# --------- |
82
|
|
|
|
|
|
|
sub isEqual { |
83
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
84
|
0
|
|
|
|
|
|
my $object = shift; |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
return 1 if $self == $object; |
87
|
0
|
0
|
|
|
|
|
return undef if (keys %{$self} != $object->keys()); |
|
0
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
return ($self->hasSubset($object) ? 1 : 0); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# --------- |
93
|
|
|
|
|
|
|
sub inheritObject { |
94
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
95
|
0
|
|
|
|
|
|
my $anObject = shift; |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
@{%{$self}}{keys %{$anObject}} = values %{$anObject}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return $self; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# --------- |
104
|
|
|
|
|
|
|
sub respondsTo { |
105
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
106
|
0
|
|
|
|
|
|
my $key = shift; |
107
|
0
|
0
|
|
|
|
|
return (exists $self->{$key}) ? 1 : 0; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# --------- |
112
|
|
|
|
|
|
|
sub attributes { |
113
|
0
|
|
|
0
|
0
|
|
return keys %{; shift}; |
|
0
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# perlish |
118
|
|
|
|
|
|
|
# --------- |
119
|
|
|
|
|
|
|
sub addAttribute { |
120
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
121
|
0
|
|
|
|
|
|
$self->addAttributeWithValue(+shift, ""); |
122
|
0
|
|
|
|
|
|
return $self; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
# --------- |
127
|
|
|
|
|
|
|
sub addAttributeWithValue { |
128
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
129
|
0
|
|
|
|
|
|
my $attributeName = shift; |
130
|
0
|
|
|
|
|
|
my $attributeDefaultValue = shift; |
131
|
|
|
|
|
|
|
|
132
|
0
|
0
|
|
|
|
|
if (exists $self->{$attributeName}) { |
133
|
0
|
|
|
|
|
|
warn "Attribute already exists: $attributeName.\n"; |
134
|
|
|
|
|
|
|
} else { |
135
|
0
|
|
|
|
|
|
return $self->{$attributeName} = $attributeDefaultValue; |
136
|
|
|
|
|
|
|
} |
137
|
0
|
|
|
|
|
|
return undef; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# --------- |
142
|
|
|
|
|
|
|
sub deleteAttribute { |
143
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
144
|
0
|
|
|
|
|
|
my $attributeName = shift; |
145
|
|
|
|
|
|
|
|
146
|
0
|
0
|
|
|
|
|
if (exists $self->{$attributeName}) { |
147
|
0
|
|
|
|
|
|
delete $self->{$attributeName}; |
148
|
|
|
|
|
|
|
} else { |
149
|
0
|
|
|
|
|
|
warn "Cowardly refusing to remove non-existant attribute: $attributeName.\n"; |
150
|
|
|
|
|
|
|
} |
151
|
0
|
|
|
|
|
|
return undef; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
# --------- |
156
|
|
|
|
|
|
|
sub AUTOLOAD { |
157
|
0
|
|
|
0
|
|
|
my $self = shift; |
158
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
my $name = $AUTOLOAD; |
160
|
0
|
|
|
|
|
|
$name =~ s/.*://; |
161
|
|
|
|
|
|
|
|
162
|
0
|
0
|
|
|
|
|
if ($name =~ m|^set(.*)|) { |
163
|
0
|
|
|
|
|
|
my $attributeName = lc(substr($1, 0, 1)) . substr($1, 1); |
164
|
0
|
0
|
|
|
|
|
if (exists $self->{$attributeName}) { |
165
|
0
|
|
|
|
|
|
$self->{$attributeName} = shift; |
166
|
|
|
|
|
|
|
} else { |
167
|
0
|
|
|
|
|
|
warn "$attributeName is not a valid setter method.\n"; |
168
|
0
|
|
|
|
|
|
return undef; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
} else { |
171
|
0
|
0
|
|
|
|
|
if (exists $self->{$name}) { |
172
|
0
|
|
|
|
|
|
return $self->{$name}; |
173
|
|
|
|
|
|
|
} else { |
174
|
0
|
|
|
|
|
|
warn "$name is not a valid accessor method.\n"; |
175
|
0
|
|
|
|
|
|
return undef; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
} |
178
|
0
|
|
|
|
|
|
return $self; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# --------- |
183
|
0
|
|
|
0
|
|
|
sub DESTROY { } |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
1337; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
__END__ |