projects
/
MojoFacets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9fb69cd
)
support scalar values in lookup
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 31 Mar 2011 17:32:31 +0000
(19:32 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 31 Mar 2011 17:32:31 +0000
(19:32 +0200)
lib/MojoFacets/Data.pm
patch
|
blob
|
history
diff --git
a/lib/MojoFacets/Data.pm
b/lib/MojoFacets/Data.pm
index
0d95269
..
83fce08
100644
(file)
--- a/
lib/MojoFacets/Data.pm
+++ b/
lib/MojoFacets/Data.pm
@@
-658,8
+658,15
@@
sub lookup {
foreach my $i ( 0 .. $#$items ) {
my $item = $items->[$i];
if ( exists $item->{$on_col} ) {
foreach my $i ( 0 .. $#$items ) {
my $item = $items->[$i];
if ( exists $item->{$on_col} ) {
- foreach my $v ( @{ $item->{$on_col} } ) {
+ if ( ref $item->{$on_col} eq 'ARRAY' ) {
+ foreach my $v ( @{ $item->{$on_col} } ) {
+ push @{ $lookup_path_col->{$on_path}->{$on_col}->{$v} }, $i;
+ }
+ } elsif ( ! ref $item->{$on_col} ) { # scalar
+ my $v = $item->{$on_col};
push @{ $lookup_path_col->{$on_path}->{$on_col}->{$v} }, $i;
push @{ $lookup_path_col->{$on_path}->{$on_col}->{$v} }, $i;
+ } else {
+ die "unknown type of ",dump $item->{$on_col};
}
}
}
}
}
}