Paranoid::Data(3pm)

πŸ“¦
version 2.10 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– Paranoid::Data πŸ’– β€” the manual page, but make it make sense

okay bestie, so this is Paranoid::Data(3pm), and honestly? it's giving "tiny module, big brain". it's the bit of the Paranoid family that does misc. data manipulation, and i'm gonna walk you through every single flag and function like we're texting at 2am. no cap. πŸ¦‹


✨ VERSION ✨

$Id: lib/Paranoid/Data.pm, 2.10 2022/03/08 00:01:04 acorliss $

that's the version string, keep it sacred πŸ’…


🌸 SYNOPSIS 🌸

here's how you actually call this stuff:

$rv = deepCopy($source, $target);
$rv = deepCopy(@source, @target);
$rv = deepCopy(%source, %target);

$rv = deepCmp($source, $target);
$rv = deepCmp(@source, @target);
$rv = deepCmp(%source, %target);

$rv = has64bInt();
($low, $high) = quad2Longs($quad);
$quad         = longs2Quad($low, $high);

like, that's the whole vibe. lowkey elegant fr fr ✨


πŸŽ€ DESCRIPTION πŸŽ€

this module provides data manipulation functions. that's it. that's the description. short, sweet, main character energy. πŸ‘‘


🫢 IMPORT LISTS 🫢

by default, importing this module hands you these symbols:

deepCopy deepCmp has64bInt

and there's one specialized import list too, in case you like being extra:

  • all β€” members: @defaults

(yeah, that's the whole list, she's short but she's powerful πŸŽ€)


πŸ’… SUBROUTINES/METHODS πŸ’…

deepCopy

$rv = deepCopy($source, $target);
$rv = deepCopy(@source, @target);
$rv = deepCopy(%source, %target);

okay so this one does a deep and safe copy of arbitrarily-shaped data structures, and along the way it's checking for circular references. hashes and lists get safely duplicated; every other data type just gets copied. and bestie, listen β€” that means any embedded object references etc. end up identical in both the source and the target. which is probably not what you want. 🫠

so like, in short: only use this on pure hash/list/scalar value data structures. and both the source and the target data types have to be of an identical type. no mixing, no matching, no exceptions.

it returns the number of elements copied, unless it hits a problem (a circular reference, say), in which case it returns a zero. periodt.

deepCmp

$rv = deepCmp($source, $target);
$rv = deepCmp(@source, @target);
$rv = deepCmp(%source, %target);

this one does a deep comparison of arbitrarily complex data structures β€” think hashes of lists of lists of scalars, etc. it returns true if the values of the structures are identical, false otherwise. and just like deepCopy, there are no provisions for evaluating objects beyond what their values are when coerced as scalar types. πŸ™ˆ

end sum, the same caveats that applied to deepCopy apply here too. iykyk.

has64bInt

$rv = has64bInt();

returns a boolean value telling you whether the platform has native 64bit integers or not. cute lil vibe check for your architecture ✨

quad2Longs

($low, $high) = quad2Longs($quad);

takes any 64bit integer and splits it into two native longs β€” in the order of low order long, high order long. and the slay part? it still works on platforms that don't support native quads. in that case, it just assumes the high order bytes equal zero. 🌈

longs2Quad

$quad = longs2Quad($low, $high);

takes two longs and combines them into a single native quad. still works on platforms without native quad support β€” but only if the value of the quad is small enough to fit into a long, which is what's actually returned in that scenario. 🧚

and if the high order bytes are not zero on a platform without native quad support, this function returns undef. noted. πŸ’€

πŸ¦‹ DEPENDENCIES πŸ¦‹

she doesn't run on vibes alone, bestie:

  • Carp
  • Paranoid
  • Paranoid::Debug

😭 BUGS AND LIMITATIONS

okay so literally nothing is listed here. zero. nada. the section exists and it's empty, so like... no known bugs and limitations, i guess? iconic of her honestly. πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

Arthur Corliss (corliss@digitalmages.com) β€” the actual legend behind all this.


this software is free software. similar to Perl, you can redistribute it and/or modify it under the terms of either:

  1. the GNU General Public License, https://www.gnu.org/licenses/gpl-1.0.html, as published by the Free Software Foundation http://www.fsf.org/; either version 1 https://www.gnu.org/licenses/gpl-1.0.html, or any later version https://www.gnu.org/licenses/license-list.html#GNUGPL, or
  2. the Artistic License 2.0, https://opensource.org/licenses/Artistic-2.0,

subject to the following additional term: No trademark rights to "Paranoid" have been or are conveyed under any of the above licenses. However, "Paranoid" may be used fairly to describe this unmodified software, in good faith, but not as a trademark. ⭐

(c) 2005 - 2020, Arthur Corliss (corliss@digitalmages.com) (tm) 2008 - 2020, Paranoid Inc. (www.paranoid.com)


aaaand that's the whole page, bestie, every last byte of it 🫢 this was rendered for perl v5.38.2, dated 2024-03-07, and if you made it this far you're officially a Paranoid::Data(3pm) girlie. go forth and deepCopy responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from