Skip to content

Commit

Permalink
Item1884: added missing require, and improved result checking
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@4600 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Aug 5, 2009
1 parent a4c2122 commit 6ecc03b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/lib/Foswiki/Query/Node.pm
Expand Up @@ -105,6 +105,7 @@ sub evaluate {

# a name; look it up in $domain{data}
eval "require $Foswiki::cfg{RCS}{QueryAlgorithm}";
die $@ if $@;
$result = $Foswiki::cfg{RCS}{QueryAlgorithm}->getField(
$this, $domain{data}, $this->{params}[0] );
}
Expand Down
13 changes: 9 additions & 4 deletions core/lib/Foswiki/Query/OP_ref.pm
Expand Up @@ -9,11 +9,12 @@
package Foswiki::Query::OP_ref;

use strict;
use Error qw( :try );

use Foswiki::Query::BinaryOP ();
our @ISA = ('Foswiki::Query::BinaryOP');

use Error qw( :try );
use Assert;

sub new {
my $class = shift;
return $class->SUPER::new( name => '/', prec => 700 );
Expand All @@ -24,6 +25,9 @@ sub evaluate {
my $pnode = shift;
my %domain = @_;

eval "require $Foswiki::cfg{RCS}{QueryAlgorithm}";
die $@ if $@;

my $a = $pnode->{params}[0];
my $node = $a->evaluate(@_);
return unless defined $node;
Expand All @@ -40,7 +44,6 @@ sub evaluate {
my ( $w, $t ) =
$Foswiki::Plugins::SESSION->normalizeWebTopicName(
$Foswiki::Plugins::SESSION->{webName}, $v );
my $result = undef;
try {
my $submeta = $Foswiki::cfg{RCS}{QueryAlgorithm}->getRefTopic(
$domain{tom}, $w, $t );
Expand All @@ -53,7 +56,9 @@ sub evaluate {
push( @result, $res );
}
}
catch Error::Simple with {};
catch Error::Simple with {
print STDERR "ERROR IN OP_ref: $_[0]->{-text}" if DEBUG;
};
}
return unless scalar(@result);
return $result[0] if scalar(@result) == 1;
Expand Down

0 comments on commit 6ecc03b

Please sign in to comment.