Scroll to navigation

Sympa::Tools::Data(3Sympa) sympa 6.2.70 Sympa::Tools::Data(3Sympa)

NAME

Sympa::Tools::Data - Functions related to data structures

DESCRIPTION

This package provides some functions related to data strucures.

Functions

Duplicates a complex variable (faster than dup_var()). TBD.

CAUTION: This duplicates blessed elements even if they are singleton/multiton; this breaks subroutine references.

Creates a custom attribute from an XML description.

Options:

$string
XML formed data as stored in database

Returns:

A hashref storing custom attributes.

Makes set operation on arrays (seen as set, with no double) :

- deleted : A \ B

- added : B \ A

- intersection : A /\ B

- union : A \/ B

Options:

$setA, $setB
Arrayrefs.

Returns:

A hashref with keys : deleted, added, intersection, union.

Dump a variable's content. TBD.
Dump a variable's content. TBD.
Duplictate a complex variable. TBD.

See also clone_var().

Create an XML Custom attribute to be stored into data base.

Options:

$hasref
Hashref storing custom attributes.

Returns:

String, XML formed data to be stored in database.

Outputs formetted configuration.

Options:

\@params
Configuration scheme. See Sympa::ConfDef.
\%curConf
Hashref including current configuration.
\%newConf
Hashref including update of configuration, if any.
Following options are possible:
"output" "=>" "["classes, ..."]"
Classes of parameters to output: Any of "mandatory", "omittable", "optional", "full" (synonym for the former tree), "minimal" (included in minimal set, i.e. described in installation instruction) and "explicit" (the parameter given an empty value with \%curConf and \%newConf).
"only_changed" "=>" 1
When both \%curConf and \%newConf are given and no changes were given, returns "undef".

Returns:

Formatted string.

This was introduced on Sympa 6.2.69b.

Returns an array made on a string splited by ','. It removes spaces.

Options:

$string
string to split

Returns:

An arrayref.

Converts a hash into a string formatted as var1="value1";var2="value2"; into a hash. TBD.
Test if a value is on an array.

Options:

$setA
An arrayref.
$value
a serached value

Returns true or false.

This applies recursively to a data structure. The transformation subroutine is passed as a ref. TBD.
Function. Check if two strings are identical.

Parameters:

$x, $y
Operands.

If both of them are undefined, they are equal. If only one of them is undefined, the are not equal. If $y is a Regexp object and it matches to $x, they are equal. Otherwise, they are compared as strings.

Returns:

If arguments matched, true value. Otherwise false value.

Compares two scalars, string/numeric independent. TBD.
Returns sorted array of unique elements in the list.

Parameters:

\&comp
Optional subroutine reference to compare each pairs of elements. It should take two arguments and return negative, zero or positive result.
@items
Items to be sorted.

This function was added on Sympa 6.2.16.

Converts a string formatted as var1="value1";var2="value2"; into a hash. Used when extracting from session table some session properties or when extracting users preference from user table. Current encoding is NOT compatible with encoding of values with '"'. TBD.

SEE ALSO

TBD.

HISTORY

TBD.

2022-11-25 6.2.70