NAME
Data::Clean::Base - Base class for Data::Clean::*
VERSION
version 0.04
METHODS
new(%opts) => $obj
Create a new instance.
Options specify what to do with problematic kinds of data. Option keys are either reference types or class names, or -obj
(to refer to objects, a.k.a. blessed references), -circular
(to refer to circular references), -ref
(to refer to references, used to process references not handled by other options). Option values are arrayrefs, the first element of the array is command name, to specify what to do with the reference/class. The rest are command arguments. Available commands:
['stringify']
This will stringify
{}
to something likeHASH(0x135f998)
.['replace_with_ref']
This will replace
{}
withHASH
.['replace_with_str', STR]
This will replace
{}
with STR.['call_method']
This will call a method and use its return as the replacement.
['deref_scalar']
This will replace \1 with 1.
Special commands for -circular
:
['detect_circular']
Keep a count for each reference. When a circular reference is found, replace it with <"CIRCULAR">.
Default options:
-ref => 'stringify'
Note that arrayrefs and hashrefs are always walked into, so it's not trapped by -ref
.
$obj->clean_in_place($data) => $cleaned
Clean $data. Modify data in-place.
$obj->clone_and_clean($data) => $cleaned
Clean $data. Clone $data first.
AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 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.