1
# See bottom of file for copyright and license details
5
---+ package Foswiki::Query::OP_ref
9
package Foswiki::Query::OP_ref;
10
use base 'Foswiki::Query::BinaryOP';
17
return $class->SUPER::new( name => '/', prec => 700 );
25
my $session = $domain{tom}->session;
26
my $topic = $domain{tom}->topic;
28
my $a = $pnode->{params}[0];
29
my $node = $a->evaluate(@_);
30
return undef unless defined $node;
31
if ( ref($node) eq 'HASH' ) {
34
if ( !( ref($node) eq 'ARRAY' ) ) {
38
foreach my $v (@$node) {
40
# Has to be relative to the web of the topic we are querying
42
$session->normalizeWebTopicName( $session->{webName}, $v );
45
my $submeta = $domain{tom}->getMetaFor( $w, $t );
46
my $b = $pnode->{params}[1];
47
my $res = $b->evaluate( tom => $submeta, data => $submeta );
48
if ( ref($res) eq 'ARRAY' ) {
49
push( @result, @$res );
52
push( @result, $res );
55
catch Error::Simple with {};
57
return undef unless scalar(@result);
58
return $result[0] if scalar(@result) == 1;
66
Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/, http://Foswiki.org/
68
# Copyright (C) 2008-2009 Foswiki Contributors. All Rights Reserved.
69
# Foswiki Contributors are listed in the AUTHORS file in the root
70
# of this distribution. NOTE: Please extend that file, not this notice.
72
# Additional copyrights apply to some or all of the code in this
75
# Copyright (C) 2005-2007 TWiki Contributors. All Rights Reserved.
76
# TWiki Contributors are listed in the AUTHORS file in the root
77
# of this distribution. NOTE: Please extend that file, not this notice.
79
This program is free software; you can redistribute it and/or
80
modify it under the terms of the GNU General Public License
81
as published by the Free Software Foundation; either version 2
82
of the License, or (at your option) any later version. For
83
more details read LICENSE in the root of this distribution.
85
This program is distributed in the hope that it will be useful,
86
but WITHOUT ANY WARRANTY; without even the implied warranty of
87
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
89
As per the GPL, removal of this notice is prohibited.
91
Author: Crawford Currie http://c-dot.co.uk