| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Chart::Sequence::Object; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = 0.000_1; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Chart::Sequence::Object - A base class with utility functions for all Chart::Sequence objects |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=for test_script t/Chart-Sequence.t |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
6
|
|
|
6
|
|
5287
|
use strict; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
187
|
|
|
20
|
6
|
|
|
6
|
|
34
|
use Carp; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
366
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=over |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=item new |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
|
29
|
|
|
|
|
|
|
|
|
30
|
6
|
|
|
6
|
|
29
|
use vars qw( %_initted_members ); |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
2021
|
|
|
31
|
|
|
|
|
|
|
sub new { |
|
32
|
1
|
50
|
|
1
|
1
|
1358
|
my $class = ref $_[0] ? ref shift : shift; |
|
33
|
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
4
|
if ( @_ == 1 ) { |
|
35
|
0
|
0
|
|
|
|
0
|
if ( ref $_[0] eq "HASH" ) { |
|
36
|
0
|
|
|
|
|
0
|
@_ = %{$_[0]}; |
|
|
0
|
|
|
|
|
0
|
|
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
4
|
my $self = bless {}, $class; |
|
41
|
1
|
|
|
|
|
3
|
local %_initted_members; |
|
42
|
1
|
|
|
|
|
4
|
while ( @_ ) { |
|
43
|
0
|
|
|
|
|
0
|
my ( $key, $value ) = ( shift, shift ); |
|
44
|
0
|
|
|
|
|
0
|
( my $method_name = $key ) =~ s/^([A-Z])/\l$1/; |
|
45
|
0
|
|
|
|
|
0
|
$method_name =~ s/([A-Z])/_\l$1/g; |
|
46
|
0
|
|
|
|
|
0
|
my $method = $self->can( "_init_$method_name" ); |
|
47
|
0
|
0
|
|
|
|
0
|
if ( $method ) { |
|
48
|
0
|
|
|
|
|
0
|
$method_name = "_init_$method_name"; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
else { |
|
51
|
0
|
|
|
|
|
0
|
$method = $self->can( $method_name ); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
0
|
0
|
|
|
|
0
|
croak "Can't find method '$method_name' in $class" unless $method; |
|
54
|
0
|
|
|
|
|
0
|
$self->$method( $value ); |
|
55
|
0
|
|
|
|
|
0
|
$_initted_members{ $method_name }++; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
1
|
|
|
|
|
4
|
$self->_init_members( ref $self ); |
|
58
|
1
|
|
|
|
|
3
|
return $self; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__PACKAGE__->make_methods(qw( $name )); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _init_members { |
|
65
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
66
|
1
|
|
|
|
|
2
|
my ( $class ) = @_; |
|
67
|
|
|
|
|
|
|
|
|
68
|
6
|
|
|
6
|
|
30
|
no strict "refs"; |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
3531
|
|
|
69
|
1
|
|
|
|
|
1
|
for ( @{"${class}::ISA"} ) { |
|
|
1
|
|
|
|
|
7
|
|
|
70
|
0
|
|
|
|
|
0
|
my $s = $_->can( "_init_members" ); |
|
71
|
0
|
0
|
|
|
|
0
|
$self->$s( $_ ) |
|
72
|
|
|
|
|
|
|
if $s; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
2
|
for ( @{"${class}::_member_initers"} ) { |
|
|
1
|
|
|
|
|
7
|
|
|
76
|
0
|
0
|
|
|
|
0
|
next if $_initted_members{$_}++; |
|
77
|
0
|
|
|
|
|
0
|
$self->$_(); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item name |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Sets/gets the name of an object. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item make_methods |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Builds accessor methods for the indicated data elements: |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__PACKAGE__->make_methods( qw( |
|
92
|
|
|
|
|
|
|
$name |
|
93
|
|
|
|
|
|
|
@messages |
|
94
|
|
|
|
|
|
|
) ); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub make_methods { |
|
99
|
11
|
|
|
11
|
1
|
21
|
my $class = shift; |
|
100
|
11
|
|
|
|
|
14
|
my @code; |
|
101
|
|
|
|
|
|
|
|
|
102
|
11
|
|
|
|
|
40
|
while ( @_ ) { |
|
103
|
16
|
|
|
|
|
29
|
local $_ = shift; |
|
104
|
16
|
50
|
66
|
|
|
87
|
my $options = @_ && ref $_[0] ? shift : {}; |
|
105
|
|
|
|
|
|
|
|
|
106
|
16
|
|
|
|
|
43
|
s/^([\$\@])//; |
|
107
|
16
|
|
100
|
|
|
87
|
my $type = $1 || "\$"; |
|
108
|
16
|
|
|
|
|
135
|
( my $n = $_ ) =~ s{(?:^|_)(\w)}{\u$1}g; |
|
109
|
|
|
|
|
|
|
|
|
110
|
16
|
50
|
|
|
|
63
|
my $set_pre = defined $options->{set_pre} ? $options->{set_pre} : ""; |
|
111
|
16
|
50
|
|
|
|
38
|
my $get_pre = defined $options->{get_pre} ? $options->{get_pre} : ""; |
|
112
|
|
|
|
|
|
|
|
|
113
|
16
|
|
|
|
|
49
|
push @code, <
|
|
114
|
|
|
|
|
|
|
\$${class}::_member_types{$_} = '$type'; |
|
115
|
|
|
|
|
|
|
END_MAP |
|
116
|
|
|
|
|
|
|
|
|
117
|
16
|
100
|
|
|
|
46
|
if ( $type eq "\$" ) { |
|
|
|
50
|
|
|
|
|
|
|
118
|
11
|
|
|
|
|
117
|
push @code, <
|
|
119
|
|
|
|
|
|
|
#line 1 ${class}::$_, compiled by Class::Sequence::Base::make_methods |
|
120
|
|
|
|
|
|
|
sub $_ { |
|
121
|
|
|
|
|
|
|
my \$self = shift; |
|
122
|
|
|
|
|
|
|
Carp::croak "Too many parameters passed" if \@_ > 1; |
|
123
|
|
|
|
|
|
|
if ( \@_ ) { |
|
124
|
|
|
|
|
|
|
local \$_ = shift; |
|
125
|
|
|
|
|
|
|
$set_pre |
|
126
|
|
|
|
|
|
|
\$self->{$n} = \$_; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
$get_pre |
|
129
|
|
|
|
|
|
|
return \$self->{$n}; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
END_SUB |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
elsif ( $type eq "\@" ) { |
|
134
|
0
|
|
|
|
|
0
|
push @code, <
|
|
135
|
|
|
|
|
|
|
#line 1 ${class}::_init_$_, compiled by Class::Sequence::Base::make_methods |
|
136
|
|
|
|
|
|
|
sub _init_$_ { |
|
137
|
|
|
|
|
|
|
my \$self = shift; |
|
138
|
|
|
|
|
|
|
\$self->{$n} = []; |
|
139
|
|
|
|
|
|
|
map \$self->push_$_( \$_ ), \@{shift()} if \@_; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
push \@${class}::_member_initers, "_init_$_"; |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
#line 1 ${class}::$_, compiled by Class::Sequence::Base::make_methods |
|
144
|
|
|
|
|
|
|
sub $_ { |
|
145
|
|
|
|
|
|
|
my \$self = shift; |
|
146
|
|
|
|
|
|
|
if ( \@_ ) { |
|
147
|
|
|
|
|
|
|
\$self->_init_$_; |
|
148
|
|
|
|
|
|
|
\$self->push_$_( \@_ ); |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
$get_pre |
|
151
|
|
|
|
|
|
|
return \@{\$self->{$n}}; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
#line 1 ${class}::${_}_ref, compiled by Class::Sequence::Base::make_methods |
|
155
|
|
|
|
|
|
|
sub ${_}_ref { |
|
156
|
|
|
|
|
|
|
my \$self = shift; |
|
157
|
|
|
|
|
|
|
Carp::croak "Too many parameters passed" if \@_ > 1; |
|
158
|
|
|
|
|
|
|
if ( \@_ ) { |
|
159
|
|
|
|
|
|
|
\$self->_init_$_; |
|
160
|
|
|
|
|
|
|
\$self->push_$_( \@{\$_[1]} ); |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
$get_pre |
|
163
|
|
|
|
|
|
|
return \$self->{$n}; |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
#line 1 ${class}::push_$_, compiled by Class::Sequence::Base::make_methods |
|
167
|
|
|
|
|
|
|
sub push_$_ { |
|
168
|
|
|
|
|
|
|
my \$self = shift; |
|
169
|
|
|
|
|
|
|
while ( \@_ ) { |
|
170
|
|
|
|
|
|
|
local \$_ = shift; |
|
171
|
|
|
|
|
|
|
$set_pre |
|
172
|
|
|
|
|
|
|
push \@{\$self->{$n}}, \$_; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
END_SUB |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
else { |
|
178
|
5
|
|
|
|
|
7284
|
croak "Unrecognized accessor type: '$type'"; |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
} |
|
181
|
6
|
50
|
|
2
|
1
|
864
|
eval join "", "package ", $class, ";\n", @code, 1 or die $@, @code; |
|
|
2
|
50
|
|
|
|
310
|
|
|
|
2
|
100
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
7
|
|
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=back |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 LIMITATIONS |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Copyright 2002, R. Barrie Slaymaker, Jr., All Rights Reserved |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 LICENSE |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
You may use this module under the terms of the BSD, Artistic, oir GPL licenses, |
|
195
|
|
|
|
|
|
|
any version. |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 AUTHOR |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Barrie Slaymaker |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=cut |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
1; |