Priority: Low
Current State: Closed
Released In: 2.1.3
Target Release: patch
Applies To: Engine
Component: Foswiki::Configure::Item
Branches: Release02x01 master
File core/lib/Foswiki/Configure/Item.pm, line 193 in master branch of commit
8775df5:
$this->{key} = $this->$fn( $val, $key );
must be:
$this->{$key} = $this->$fn( $val, $key );
--
VadimBelman - 05 Jan 2017
It does seem to be a typo, but this causes all of the
ConfigureQueryTests to fail. I can't check it into 2.1.3 beta
--
GeorgeClark - 12 Jan 2017
Crawford, do you have any ideas on this one?
--
GeorgeClark - 12 Jan 2017
Applying this change results in
Foswiki::Configure::Query::getspec errors: /var/www/foswiki/distro/core/lib/Foswiki.spec: 1804: Can't use string ("1") as an ARRAY ref while "strict refs" in use at /var/www/foswiki/distro/core/lib/Foswiki/Configure/Value.pm line 224, <$fh> line 1808.
at /var/www/foswiki/distro/core/lib/Foswiki/Configure/Value.pm line 224, <$fh> line 1808.
Foswiki::Configure::Value::_FEEDBACK(Foswiki::Configure::Value=HASH(0x40373b0), "icon='ui-icon-mail-closed';label='Send Test Email';wizard='Se"..., "FEEDBACK") called at /var/www/foswiki/distro/core/lib/Foswiki/Configure/Item.pm line 193
Foswiki::Configure::Item::_parseOptions(Foswiki::Configure::Value=HASH(0x40373b0), "30 LABEL=\"Webmaster Email\" FEEDBACK=\"icon='ui-icon-mail-open "...) called at /var/www/foswiki/distro/core/lib/Foswiki/Configure/Item.pm line 107
Foswiki::Configure::Item::set(Foswiki::Configure::Value=HASH(0x40373b0), "typename", "EMAILADDRESS", "keys", "", "opts", "30 LABEL=\"Webmaster Email\" FEEDBACK=\"icon='ui-icon-mail-open "..., "defined_at", ARRAY(0x4040fb0), ...) called at /var/www/foswiki/distro/core/lib/Foswiki/Configure/Item.pm line 50
Foswiki::Configure::Item::new("Foswiki::Configure::Value", "typename", "EMAILADDRESS", "keys", "", "opts", "30 LABEL=\"Webmaster Email\" FEEDBACK=\"icon='ui-icon-mail-open "..., "defined_at", ARRAY(0x4040fb0), ...) called at /var/www/foswiki/distro/core/lib/Foswiki/Configure/Value.pm line 133
Foswiki::Configure::Value::new("Foswiki::Configure::Value", "EMAILADDRESS", "opts", "30 LABEL=\"Webmaster Email\" FEEDBACK=\"icon='ui-icon-mail-open "...,
--
GeorgeClark - 12 Jan 2017
This patch seems to work fine. Unit tests pass, and configure runs fine. I can't find anywhere else in the code that any hash is referenced with
{key}
.
diff --git a/core/lib/Foswiki/Configure/Item.pm b/core/lib/Foswiki/Configure/Item.pm
index 1b04bcf..17f8dbb 100644
--- a/core/lib/Foswiki/Configure/Item.pm
+++ b/core/lib/Foswiki/Configure/Item.pm
@@ -190,7 +190,7 @@ sub _parseOptions {
&& !$Foswiki::Configure::LoadSpec::RAW_VALS )
{
my $fn = $spec->{handler};
- $this->{key} = $this->$fn( $val, $key );
+ $this->$fn( $val, $key );
}
else {
$this->{$key} = $val;
--
GeorgeClark - 12 Jan 2017
I think CDot must approve it. The working patch looks pretty confusing.
--
VadimBelman - 12 Jan 2017
George's patch is correct. This is the handing for a delegated option. For example,
FEEDBACK="icon='ui-icon-check'"
where the value of the option is recursively parsed using a provided handler. The delegated parser is expected to populate the Configure::Item object directly. In the specific case of
FEEDBACK
, the delegated parser is
Configure::Value::_FEEDBACK
. The side effect of setting
->{key}
is that an extra field is set in the Item object but it's just ignored. Here's a modified patch that enhances the doc as well.
diff --git a/core/lib/Foswiki/Configure/Value.pm b/core/lib/Foswiki/Configure/Value.pm
index 1fe5595..2451662 100755
--- a/core/lib/Foswiki/Configure/Value.pm
+++ b/core/lib/Foswiki/Configure/Value.pm
@@ -13,39 +13,34 @@ item. This object is the *model* only.
---++ Value Attributes
Values may have attributes associated with them in the .spec file. These
-attributes are identified by UPPERCASE names and may be one of four types:
+attributes are identified by UPPERCASE names and may be either:
- * boolean - a single name enables the option.
+ * boolean - a single name enables the option, for example EXPERT
* string - a name followed by an equals sign, followed by a quoted string
- (single or double quotes both supported)
- * keyword - a name followed by a keyword
+ (single or double quotes both supported) for example LABEL="Wibble".
+ (see also &&& below)
The special prefix 'NO' on any attribute name will clear the value of
that attributes.
-In support of older .spec files, the following are also supported (though
+&&& In support of older .spec files, the following are also supported (though
their usage is deprecated):
* Single-character attribute H. This is synonymous with HIDDEN.
* Single-character attribute M is ignored.
- * Unquoted conditions - DISPLAY_IF and ENABLE_IF may be followed by a
+ * Unquoted attribute values - DISPLAY_IF and ENABLE_IF may be followed by a
a space, and terminated by /DISPLAY_IF (or /ENABLE_IF) or the end of
the string.
-Formally,
+Certain attributes define a 'delegate' that allows further parsing of the
+value of an attribute. A delegate is a ref to a function that performs
+this parsing. Delegates are responsible for directly modifying the item
+on which they are run.
-attrs ::= attr attrs ;
-attr ::= name '=' values | name ;
-values ::= value | values ';' fattr ;
-value ::= quoted-string | name ;
-name is made up of [-A-Z0-9]
-
-Certain attributes define a 'process' that allows further parsing of the
-value of an attribute. A process is a ref to a function that performs
-this parsing. Execution of processes may be supressed by setting
+Execution of delegates may be supressed by setting
$Foswiki::Configure::LoadSpec::RAW_VALS to 1.
-Processes are used to parse 'FEEDBACK' and 'CHECK' values.
+Delegates are used to parse 'FEEDBACK' and 'CHECK' values.
=cut
--
Main.CrawfordCurrie - 13 Jan 2017 - 09:36