line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TM::Tied::Association; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
4
|
use Data::Dumper; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
10
|
use Tie::Hash; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
7
|
1
|
|
|
1
|
|
9
|
use base qw(Tie::StdHash); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
965
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub STORE { |
10
|
0
|
|
|
0
|
|
|
my ($self, $key, $value) = @_; |
11
|
0
|
|
|
|
|
|
warn "STORE assoc $key"; |
12
|
0
|
|
|
|
|
|
return $self->{lc $key} = $value; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
sub FETCH { |
15
|
0
|
|
|
0
|
|
|
my ($self, $key) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
0
|
|
|
|
if ($key =~ /\s*->\s*(.*)_s$/ || $key =~ /(.*)_s/) { # if it looks -> xxx_s or just xxx_s => pluralized |
|
|
0
|
0
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $role = $self->{__tm}->tids ($1); |
19
|
0
|
|
|
|
|
|
my $a = $self->{__tm}->retrieve ($self->{__aid}); |
20
|
|
|
|
|
|
|
return [ |
21
|
0
|
|
|
|
|
|
map { new TM::Easy::Topic ($_, $self->{__tm}) } |
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$self->{__tm}->get_players ($a, $role) # take all |
23
|
|
|
|
|
|
|
]; |
24
|
|
|
|
|
|
|
} elsif ($key =~ /\s*->\s*(.*)/ || $key =~ /(.*)/) { # if it looks -> xxx or just xxx |
25
|
0
|
|
|
|
|
|
my $role = $self->{__tm}->tids ($1); |
26
|
0
|
|
|
|
|
|
my $a = $self->{__tm}->retrieve ($self->{__aid}); |
27
|
0
|
|
|
|
|
|
my ($p) = $self->{__tm}->get_players ($a, $role); # take ONE |
28
|
0
|
|
|
|
|
|
return new TM::Easy::Topic ($p, $self->{__tm}); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
sub EXISTS { |
32
|
0
|
|
|
0
|
|
|
my ($self, $key) = @_; |
33
|
0
|
|
|
|
|
|
return exists $self->{lc $key}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
sub DEFINED { |
36
|
0
|
|
|
0
|
0
|
|
my ($self, $key) = @_; |
37
|
0
|
|
|
|
|
|
return defined $self->{lc $key}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
sub TIEHASH { |
40
|
0
|
|
|
0
|
|
|
my $self = bless {}, shift; |
41
|
0
|
|
|
|
|
|
$self->{__aid} = shift; |
42
|
0
|
|
|
|
|
|
$self->{__tm} = shift; |
43
|
0
|
|
|
|
|
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
sub FIRSTKEY { |
46
|
0
|
|
|
0
|
|
|
my $self = shift; |
47
|
0
|
|
|
|
|
|
my $a = $self->{__tm}->retrieve ($self->{__aid}); |
48
|
0
|
|
|
|
|
|
$self->{__rs} = [ @{ $self->{__tm}->get_role_s ($a) } ]; # this is a list copy |
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return shift @{ $self->{__rs} }; |
|
0
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
sub NEXTKEY { |
52
|
0
|
|
|
0
|
|
|
my $self = shift; |
53
|
0
|
|
|
|
|
|
return shift @{ $self->{__rs} }; |
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |