Item1884: OP_ref broken on trunk (patch available)

pencil
Priority: Urgent
Current State: Closed
Released In:
Target Release: n/a
Applies To: Engine
Component:
Branches:
Reported By: MichaelDaum
Waiting For: Main.CrawfordCurrie
Last Change By: MichaelTempest
Test (taken from the docu):

You type:

%IF{"'%SYSTEMWEB%.WebHome'/lc(text)~'*welcome*'" then="contains 'welcome'" else="woops"}%

You get (works here):

contains 'welcome'

But on trunk it's woops ... which is wrong.

Here's the patch... not sure if that's correct. Crawford can you check, please?

--- OP_ref.pm   (revision 4593)
+++ OP_ref.pm   (working copy)
@@ -40,10 +40,8 @@
         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 );
+            my $submeta = Foswiki::Meta->load($Foswiki::Plugins::SESSION, $w, $t );
             my $b       = $pnode->{params}[1];
             my $res     = $b->evaluate( tom => $submeta, data => $submeta );
             if ( ref($res) eq 'ARRAY' ) {

-- MichaelDaum - 04 Aug 2009

No, it's not correct because it blows away the refactoring I did to decouple the query engine from the store engine. I will investigate further.

-- CrawfordCurrie - 05 Aug 2009

There was a missing require.

-- CrawfordCurrie - 05 Aug 2009

If I may be picky, why do you eval then die:
+    eval "require $Foswiki::cfg{RCS}{QueryAlgorithm}";
+    die $@ if $@;
If I'm not mistaken, this does exactly the same as:
+    require $Foswiki::cfg{RCS}{QueryAlgorithm};
Innit?

-- OlivierRaginel - 05 Aug 2009

@Olivier:

From perldoc -f require:
require EXPR
If EXPR is a bareword, the require assumes a ".pm" extension and replaces "::" with "/" in the filename for you, to make it easy to load standard modules.

eval "require $var" is needed if $var may be a package name.

-- MichaelTempest - 08 Aug 2009

ItemTemplate edit

Summary OP_ref broken on trunk (patch available)
ReportedBy MichaelDaum
Codebase trunk
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor CrawfordCurrie
Checkins distro:6ecc03b13d66
TargetRelease n/a
ReleasedIn
Topic revision: r5 - 08 Aug 2009, MichaelTempest
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy