NAME
DDC::PP::Object - common perl base class for DDC::PP objects
SYNOPSIS
#-- Preliminaries
use DDC::PP;
$CLASS = 'DDC::PP::Object';
##---------------------------------------------------------------------
## C -> Perl
$q    = DDC::PP->parse("foo && bar");
$qs   = $q->toString;                  ##-- $qs is "('foo' && 'bar')"
$hash = $q->toHash();                  ##-- query encoded as perl hash-ref
#... the perl object can be manipulated directly (perl refcounting applies)
$hash->{Dtr1} = {class=>'CQTokExact',Value=>'baz'};    ##-- NO memory leak!
##---------------------------------------------------------------------
## Perl->C
$q2   = $CLASS->newFromHash($hash);    ##-- $q2 needs explicit free()
$qs2  = $q2->toString();               ##-- $qs2 is "(@'baz' && 'bar')
##---------------------------------------------------------------------
## Deep copy & Traversal
$q3 = $q->clone();                     ##-- wraps newFromHash($q->toHash)
$q  = $q->mapTraverse(\&CODE);         ##-- recursively tweak sub-objects
##---------------------------------------------------------------------
## JSON utilities
$json = $q->toJson();                  ##-- ddc-internal json-ification
$json = $q->TO_JSON();                 ##-- wraps toHash() for the JSON module
$obj  = $CLASS->newFromJson($str);     ##-- wraps newFromHash(from_json($str))
##---------------------------------------------------------------------
## Debugging
$obj->DumpTree();                      ##-- dumps substructure to STDERR
$obj->free();                          ##-- expplicit deep destruction, use at your own risk
\@kids = $obj->Children();             ##-- ARRAY-ref of direct children
\@desc = $obj->Descendants();          ##-- ARRAY-ref of descendants
undef  = $obj->DisownChildren();       ##-- prevent deep destruction (dummy method; you should never need this)
$cnt   = $obj->refcnt();               ##-- get internal reference count (dummy method)
DESCRIPTION
The DDC::PP::Object class is a pure-perl fork of the DDC::XS::Object class, which see.
SEE ALSO
perl(1), DDC::PP(3perl), DDC::PP::CQuery(3perl), DDC::PP::CQCount(3perl), DDC::PP::CQFilter(3perl), DDC::PP::CQueryOptions(3perl), DDC::PP::CQueryCompiler(3perl).
AUTHOR
Bryan Jurish <moocow@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2016 by Bryan Jurish
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.