NAME
SHARYANTO::Data::Util - Data utilities
VERSION
version 0.57
SYNOPSIS
DESCRIPTION
FUNCTIONS
None are exported by default, but they are exportable.
clone_circular_refs(@args) -> any
For example, this data:
$x = [1];
$data = [$x, 2, $x];
contains circular references by referring to $x
twice. After clone_circular_refs
, data will become:
$data = [$x, 2, [1]];
that is, the subsequent circular references will be deep-copied. This makes it safe to transport to JSON, for example.
Sometimes it doesn't work, for example:
$data = [1];
push @$data, $data;
Cloning will still create circular references.
This function modifies the data structure in-place, and return true for success and false upon failure.
Arguments ('*' denotes required arguments):
data* => any
Return value:
has_circular_ref(@args) -> any
Does not deal with weak references.
Arguments ('*' denotes required arguments):
data* => any
Return value:
SEE ALSO
Data::Structure::Util has the XS/C version of has_circular_ref
which is 3 times or more faster than this module's implementation which is pure Perl). Use that instead if possible (in some cases, Data::Structure::Util fails to build and this module provides an alternative for that function).
This module is however much faster than Devel::Cycle.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/SHARYANTO-Data-Util.
SOURCE
Source repository is at https://github.com/sharyanto/perl-SHARYANTO-Data-Util.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=SHARYANTO-Data-Util
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.