line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Audio::Nama::Object; |
2
|
5
|
|
|
5
|
|
22856
|
use Modern::Perl; |
|
5
|
|
|
|
|
13400
|
|
|
5
|
|
|
|
|
935
|
|
3
|
5
|
|
|
5
|
|
522
|
use Carp; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
351
|
|
4
|
5
|
|
|
5
|
|
1729
|
use Audio::Nama::Assign qw(json_out); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
521
|
|
5
|
5
|
|
|
5
|
|
29
|
use Storable qw(dclone); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
302
|
|
6
|
5
|
|
|
5
|
|
32
|
use Data::Dumper::Concise; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
364
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
26
|
no strict; # Enable during dev and testing |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
510
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
5
|
|
|
5
|
|
102
|
require 5.004; |
11
|
5
|
|
|
|
|
2860
|
$Audio::Nama::Object::VERSION = '1.04'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub import { |
15
|
29
|
100
|
|
29
|
|
1526
|
return unless shift eq 'Audio::Nama::Object'; |
16
|
18
|
|
|
|
|
48
|
my $pkg = caller; |
17
|
18
|
|
|
|
|
30
|
my $child = 0+@{"${pkg}::ISA"}; |
|
18
|
|
|
|
|
352
|
|
18
|
|
|
|
|
|
|
eval join '', |
19
|
|
|
|
|
|
|
"package $pkg;\n", |
20
|
|
|
|
|
|
|
' use vars qw(%_is_field); ', |
21
|
|
|
|
|
|
|
' map{ $_is_field{$_}++ } @_;', |
22
|
|
|
|
|
|
|
($child ? () : "\@${pkg}::ISA = Audio::Nama::Object;\n"), |
23
|
|
|
|
|
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
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
or die "Invalid accessor name '$_'"; |
26
|
128
|
|
|
|
|
2108
|
"sub $_ { \$_[0]->{$_} }" |
27
|
|
|
|
|
|
|
} @_; |
28
|
17
|
50
|
|
|
|
128
|
die "Failed to generate $pkg" if $@; |
29
|
17
|
|
|
|
|
147135
|
return 1; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
1
|
|
|
1
|
0
|
19
|
my $class = shift; |
34
|
1
|
|
|
|
|
5
|
bless { @_ }, $class; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub is_legal_key { |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# The behavior I want here is: |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# Example class hierachy: Audio::Nama::Object, Audio::Nama::Wav, Audio::Nama::Track, Audio::Nama::SimpleTrack |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# By inheriting from Track, SimpleTrack gets all the |
44
|
|
|
|
|
|
|
# attributes of Track and Wav, without having to include |
45
|
|
|
|
|
|
|
# them in the Track class definition |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
0
|
3
|
my ($class, $key) = @_; |
48
|
1
|
50
|
|
|
|
3
|
$class = ref $class if ref $class; # support objects |
49
|
1
|
50
|
|
|
|
2
|
return 1 if ${"$class\::_is_field"}{$key}; |
|
1
|
|
|
|
|
11
|
|
50
|
0
|
|
|
|
|
0
|
my ($parent_class) = @{"$class\::ISA"}; |
|
0
|
|
|
|
|
0
|
|
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
0
|
|
|
0
|
return unless $parent_class and $parent_class !~ /Object::Tiny/; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# this should be: |
55
|
|
|
|
|
|
|
# return unless $parent_class and $parent_class !~ /Object/; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
0
|
is_legal_key($parent_class,$key); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
sub set { |
60
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
61
|
1
|
|
|
|
|
3
|
my $class = ref $self; |
62
|
|
|
|
|
|
|
#print "class: $class, args: @_\n"; |
63
|
1
|
50
|
|
|
|
4
|
croak "odd number of arguments ",join "\n--\n" ,@_ if @_ % 2; |
64
|
1
|
|
|
|
|
4
|
my %new_vals = @_; |
65
|
|
|
|
|
|
|
map{ |
66
|
1
|
|
|
|
|
3
|
$self->{$_} = $new_vals{$_} ; |
|
1
|
|
|
|
|
3
|
|
67
|
1
|
|
|
|
|
2
|
my $key = $_; |
68
|
1
|
50
|
|
|
|
5
|
is_legal_key(ref $self, $key) or croak "illegal key: $_ for object of type ", ref $self; |
69
|
|
|
|
|
|
|
} keys %new_vals; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
sub dumpp { |
72
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
73
|
0
|
|
|
|
|
0
|
print $self->dump |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
sub dump { |
76
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
77
|
0
|
|
|
|
|
0
|
my $output = Dumper($self); |
78
|
0
|
|
|
|
|
0
|
return $output; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub as_hash { |
82
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
83
|
0
|
|
|
|
|
0
|
my $class = ref $self; |
84
|
0
|
|
|
|
|
0
|
bless $self, 'HASH'; # easy magic |
85
|
0
|
|
|
|
|
0
|
my %guts = %{ $self }; |
|
0
|
|
|
|
|
0
|
|
86
|
0
|
|
|
|
|
0
|
bless $self, $class; |
87
|
0
|
0
|
|
|
|
0
|
$guts{class} = $class if is_legal_key(ref $self, 'class'); |
88
|
0
|
|
|
|
|
0
|
return \%guts; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |