This is an interface that is implemented by all back-end stores (archivists). A Map is basically a hash table, and can be tied to a perl hash.
Objects of this class are created using thenewMap
interface defined
by Foswiki::Contrib::DBCacheContrib::Archivist
. You can use references
in the content of a Map, but you can only refer to other objects that
were created using the same Archivist. If you point anywhere else, expect
fireworks.
The keys in a map operate like any other keys, except that key names beginning with underscore are interpreted as internal references to objects that must be "weak" i.e. are not used in garbage collection (see the doc on Scalar::Util::weaken for more info).
ObjectMethod
parse($string) Parse a bunch of key-value expressions in $string and add them to the map. $string is a space-or-comma separated list of key=value pairs, where values can be enclosed in quotes (either single or double). Keys must be alphanumeric plus '.'. For example:
this.that='the other', one3three=four five="5"
get($k, $root)
→ datum $k
- key
$root
what # refers to
$k
; return if not set.
Subfield syntax get("X",$r)
will get the subfield named X
.
get("X.Y",$r)
will get the subfield Y
of the subfield named X
.
get("[X]",$r) = will get the subfield named =X
(so X[Y] and X.Y are synonymous)..
#
means "reset to root". So get("#.Y", $r) will return the subfield =Y
of $r (assuming $r is a map!), as will get("#[Y]"
.
get("UserTable[0].Surname", $web);See also
Foswiki::Contrib::DBCacheContrib::Array
for syntax that applies to arrays.
set($k, $v)
$k
- key
$v
- value
size()
→ integer remove($index)
→ old value $index
- integer index
search($search)
→ search result $search
- Foswiki::Contrib::DBCacheContrib::Search object to use in the search
Foswiki::Contrib::DBCacheContrib::Array
of matching keys.
getKeys() → @keys
getValues() → @values
toString($limit, $level, $strung)
→ string $limit
- recursion limit for expansion of elements
$level
- currentl recursion level