logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Paranoid::Data - Misc. Data Manipulation Functions

Author

       Arthur Corliss (corliss@digitalmages.com)

Bugs And Limitations

Dependencies

       o   Carp

       o   Paranoid

       o   Paranoid::Debug

Description

       This module provides data manipulation functions.

Import Lists

       This module exports the following symbols by default:

           deepCopy deepCmp has64bInt

       The following specialized import lists also exist:

           List        Members
           --------------------------------------------------------
           all         @defaults

Name

       Paranoid::Data - Misc. Data Manipulation Functions

Subroutines/Methods

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

       This function performs a deep and safe copy of arbitrary data structures, checking for circular
       references along the way.  Hashes and lists are safely duplicated while all other data types are just
       copied.  This means that any embedded object references, etc., are identical in both the source and the
       target, which is probably not what you want.

       In short, this should only be used on pure hash/list/scalar value data structures.  Both the source and
       the target data types must be of an identical type.

       This function returns the number of elements copied unless it runs into a problem (such as a circular
       reference), in which case it returns a zero.

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

       This function performs a deep comparison of arbitrarily complex data structures (i.e., hashes of lists of
       lists of scalars, etc.).  It returns true if the values of the structures are identical, false otherwise.
       Like the deepCopy function 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.

   has64bInt
           $rv = has64bInt();

       This function returns a boolean value denoting whether the platform has native 64bit integers or not.

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

       This function takes any 64bit integer and splits it into two native longs, in the order of low order
       long, high order long.  This function will still work on platforms that don't support native quads.  In
       that case, it will just be assumed that the high order bytes equal zero.

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

       This function takes two longs and combines them into a single native quad.  This function will still work
       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.

       In the case of the high order bytes are not zero on a platform without native quad support, this function
       will return undef.

Synopsis

           $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);

Version

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

See Also