Sympa::Tools::Data(3Sympa)
π NAME π
Sympa::Tools::Data β bestie, this is the little toolbox of functions that do stuff with data structures β¨
It ships with sympa 6.2.80, and it's one of the Sympa::Tools::* squad, so you already know the vibe: small package, specific job, comes through when you need it π«Ά
πΈ DESCRIPTION πΈ
Okay so, this package is literally just a grab-bag of functions related to data structures. That's it. That's the whole pitch. No cap.
π Functions π
clone_var (...)
Duplicates a complex variable β and it's faster than dup_var() π
TBD.
CAUTION bestie, listen to me: this one duplicates blessed elements even if they are singleton/multiton. Which means it breaks subroutine references. Like, completely. It's giving chaos. Proceed accordingly π
decode_custom_attribute ($string)
Creates a custom attribute from an XML description β¨
Options:
$stringβ XML formed data, exactly as it's stored in the database.
Returns:
A hashref storing custom attributes π
diff_on_arrays ( $setA, $setB )
Makes set operation on arrays β and yes, we're treating them as sets, with no double π
deleted:A \ Badded:B \ Aintersection:A /\ Bunion:A \/ B
Options:
$setA,$setBβ Arrayrefs.
Returns:
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 (...)
Duplicate a complex variable. TBD.
See also clone_var() β they're cousins π«Ά
encode_custom_attribute ($hashref)
Create an XML Custom attribute to be stored into the data base β¨
Options:
$hasrefβ Hashref storing custom attributes.
Returns:
String β XML formed data to be stored in the database π
format_config (\@params, [ \%curConf, [ \%newConf ] ], [ key "=>" val ... ] ))
Outputs formatted configuration π
Options:
\@paramsβ Configuration scheme. SeeSympa::ConfDef.\%curConfβ Hashref including current configuration.\%newConfβ Hashref including update of configuration, if any.key "=>" val ...β more options below, bestie:"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\%curConfand\%newConf) β¨"only_changed" "=>" 1β When both\%curConfand\%newConfare given and no changes were given, returns"undef".
Returns:
Formatted string πΈ
Fun fact for the lore girlies: 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 π§
Options:
$stringβ string to split.
Returns:
An arrayref π
hash_2_string (...)
Converts a hash into a string formatted as var1="value1";var2="value2"; into a hash. TBD. (yes bestie, the sentence is like that, I don't make the rules π)
is_in_array ( $setA, $value )
Deprecated. Test if a value is on an array.
Options:
$setAβ An arrayref.$valueβ 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 π―
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 β¨
smart_lessthan (...)
Compares two scalars, string/numeric independent. TBD. π₯
sort_uniq ( [ \&comp ], @items )
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.
Lore drop: 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 π¦
TBD.
β HISTORY β
TBD.
Alright bestie, that's the whole page π Big thanks to the sympa 6.2.80 girlies for this one, dated 2026-10-19 β mwah, slay, periodt π β¨π
π¦ where this page comes from
- fedora 43: sympa-devel-doc 6.2.80-2.fc43 Β· GPL-2.0-or-later AND (OFL-1.1-RFN AND MIT) AND OFL-1.1-RFN AND MIT and (MIT OR GPL-2.0-only)
- fedora 44: sympa-devel-doc 6.2.80-2.fc44 Β· GPL-2.0-or-later AND (OFL-1.1-RFN AND MIT) AND OFL-1.1-RFN AND MIT and (MIT OR GPL-2.0-only)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms