Sympa::Tools::Data.3Sympa - Man Page

Functions related to data structures


This package provides some functions related to data strucures.


clone_var (...)

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

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

decode_custom_attribute ($string)

Creates a custom attribute from an XML description.



XML formed data as stored in database


A hashref storing custom attributes.

diff_on_arrays ( $setA, $setB )

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

- deleted : A \ B

- added : B \ A

- intersection : A /\ B

- union : A \/ B


$setA, $setB



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

dump_html_var (...)

Dump a variable's content. TBD.

dump_var (...)

Dump a variable's content. TBD.

dup_var (...)

Duplictate a complex variable. TBD.

See also clone_var().

encode_custom_attribute ($hashref)

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



Hashref storing custom attributes.


String, XML formed data to be stored in database.

format_config (\@params, [ \%curConf, [ \%newConf ] ], [ key => val ... ] ))

Outputs formetted configuration.



Configuration scheme. See Sympa::ConfDef.


Hashref including current configuration.


Hashref including update of configuration, if any.

key => val ...

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.


Formatted string.

This was introduced on Sympa 6.2.70.

get_array_from_splitted_string ($string)

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



string to split


An arrayref.

hash_2_string (...)

Converts a hash into a string formatted as var1="value1";var2="value2"; into a hash. TBD.

is_in_array ( $setA, $value )

Test if a value is on an array.



An arrayref.


a serached value

Returns true or false.

recursive_transformation (...)

This applies recursively to a data structure. The transformation subroutine is passed as a ref. TBD.

smart_eq ( $x, $y )

Function. Check if two strings are identical.


$x, $y


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.


If arguments matched, true value.  Otherwise false value.

smart_lessthan (...)

Compares two scalars, string/numeric independent. TBD.

sort_uniq ( [ \&comp ], @items )

Returns sorted array of unique elements in the list.



Optional subroutine reference to compare each pairs of elements. It should take two arguments and return negative, zero or positive result.


Items to be sorted.

This function was added on Sympa 6.2.16.

string_2_hash (...)

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





2023-07-22 sympa 6.2.72