{
    "mode": "perldoc",
    "parameter": "Data::Grove::Parent",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Data%3A%3AGrove%3A%3AParent/json",
    "generated": "2026-06-14T00:36:50Z",
    "synopsis": "use Data::Grove::Parent;\n$root = $object->root;\n$rootpath = $object->rootpath;\n$tied = $object->addmagic([ $parent ]);\n$node = Data::Grove::Parent->new($hash [, $parent]);\n$nodelist = Data::Grove::ParentList->new($array [, $parent]);",
    "sections": {
        "NAME": {
            "content": "Data::Grove::Parent - provide parent properties to Data::Grove objects\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Data::Grove::Parent;\n\n$root = $object->root;\n$rootpath = $object->rootpath;\n$tied = $object->addmagic([ $parent ]);\n\n$node = Data::Grove::Parent->new($hash [, $parent]);\n$nodelist = Data::Grove::ParentList->new($array [, $parent]);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Data::Grove::Parent is an extension to Data::Grove that adds `\"Parent\"' and `\"Raw\"' properties\nto Data::Grove objects and methods for returning the root node of a grove, a list of nodes\nbetween and including the root node and the current node, and a method that creates parented\nnodes.\n\nData::Grove::Parent works by creating a Perl ``tied'' object that contains a parent reference\n(`\"Parent\"') and a reference to the original Data::Grove object (`\"Raw\"'). Tying-magic is used\nso that every time you reference the Data::Grove::Parent object it actually references the\nunderlying raw object.\n\nWhen you retrieve a list or a property of the Raw object, Data::Grove::Parent automatically adds\nmagic to the returned list or node. This means you only call `addmagic()' once to create the\nfirst Data::Grove::Parent object and then use the grove objects like you normally would.\n\nThe most obvious use of this is so you don't have to call a `\"delete\"' method when you want to\nrelease a grove or part of a grove; since Data::Grove and Data::Grove::Parent objects have no\ncyclic references, Perl can garbage collect them normally.\n\nA secondary use is to allow you to reuse grove or property set fragments in multiple trees.\nWARNING: Data::Grove currently does not protect you from creating your own cyclic references!\nThis could lead to infinite loops if you don't take care to avoid them.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "$object->root()\n$object->rootpath()\n`\"root()\"' returns the root node if `$object' is a `\"Data::Grove::Parent\"' object.\n`\"rootpath()\"' returns an array of all the nodes between and including the root node and\n`$object'.\n\n$tied = $object->addmagic([ $parent ])\n`\"addmagic()\"' returns a \"Data::Grove::Parent\" object with `$object' as it's `\"Raw\"'\nobject. If `$parent' is given, that becomes the tied object's parent object.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Ken MacLeod, ken@bitsko.slc.ut.us\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "",
            "subsections": [
                {
                    "name": "perl",
                    "content": ""
                }
            ]
        }
    },
    "summary": "Data::Grove::Parent - provide parent properties to Data::Grove objects",
    "flags": [],
    "examples": [],
    "see_also": []
}