{
    "content": [
        {
            "type": "text",
            "text": "# Data::Visitor::Callback (perldoc)\n\n## NAME\n\nData::Visitor::Callback - A Data::Visitor with callbacks.\n\n## SYNOPSIS\n\nuse Data::Visitor::Callback;\nmy $v = Data::Visitor::Callback->new(\n# you can provide callbacks\n# $ will contain the visited value\nvalue => sub { ... },\narray => sub { ... },\n# you can also delegate to method names\n# this specific example will force traversal on objects, by using the\n# 'visitref' callback which normally traverse unblessed references\nobject => \"visitref\",\n# you can also use class names as callbacks\n# the callback will be invoked on all objects which inherit that class\n'Some::Class' => sub {\nmy ( $v, $obj ) = @; # $v is the visitor\n...\n},\n);\n$v->visit( $someperlvalue );\n\n## DESCRIPTION\n\nThis is a Data::Visitor subclass that lets you invoke callbacks instead of needing to subclass\nyourself.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS**\n- **CALLBACKS**\n- **SUPPORT**\n- **AUTHORS**\n- **COPYRIGHT AND LICENCE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Data::Visitor::Callback",
        "section": "",
        "mode": "perldoc",
        "summary": "Data::Visitor::Callback - A Data::Visitor with callbacks.",
        "synopsis": "use Data::Visitor::Callback;\nmy $v = Data::Visitor::Callback->new(\n# you can provide callbacks\n# $ will contain the visited value\nvalue => sub { ... },\narray => sub { ... },\n# you can also delegate to method names\n# this specific example will force traversal on objects, by using the\n# 'visitref' callback which normally traverse unblessed references\nobject => \"visitref\",\n# you can also use class names as callbacks\n# the callback will be invoked on all objects which inherit that class\n'Some::Class' => sub {\nmy ( $v, $obj ) = @; # $v is the visitor\n...\n},\n);\n$v->visit( $someperlvalue );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "CALLBACKS",
                "lines": 76,
                "subsections": []
            },
            {
                "name": "SUPPORT",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENCE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Data::Visitor::Callback - A Data::Visitor with callbacks.\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 0.31\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Data::Visitor::Callback;\n\nmy $v = Data::Visitor::Callback->new(\n# you can provide callbacks\n# $ will contain the visited value\n\nvalue => sub { ... },\narray => sub { ... },\n\n\n# you can also delegate to method names\n# this specific example will force traversal on objects, by using the\n# 'visitref' callback which normally traverse unblessed references\n\nobject => \"visitref\",\n\n\n# you can also use class names as callbacks\n# the callback will be invoked on all objects which inherit that class\n\n'Some::Class' => sub {\nmy ( $v, $obj ) = @; # $v is the visitor\n\n...\n},\n);\n\n$v->visit( $someperlvalue );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is a Data::Visitor subclass that lets you invoke callbacks instead of needing to subclass\nyourself.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "new %opts, %callbacks\nConstruct a new visitor.\n\nThe options supported are:\n\nignorereturnvalues\nWhen this is true (off by default) the return values from the callbacks are ignored,\nthus disabling the fmapping behavior as documented in Data::Visitor.\n\nThis is useful when you want to modify $ directly\n\ntiedasobjects\nWhether or not to visit the \"tied\" in perlfunc of a tied structure instead of pretending\nthe structure is just a normal one.\n\nSee \"visittied\" in Data::Visitor.\n",
                "subsections": []
            },
            "CALLBACKS": {
                "content": "Use these keys for the corresponding callbacks.\n\nThe callback is in the form:\n\nsub {\nmy ( $visitor, $data ) = @;\n\n# or you can use $, it's aliased\n\nreturn $data; # or modified data\n}\n\nWithin the callback $ is aliased to the data, and this is also passed in the parameter list.\n\nAny method can also be used as a callback:\n\nobject => \"visitref\", # visit objects anyway\n\nvisit\nCalled for all values\n\nvalue\nCalled for non objects, non container (hash, array, glob or scalar ref) values.\n\nrefvalue\nCalled after \"value\", for references to regexes, globs and code.\n\nplainvalue\nCalled after \"value\" for non references.\n\nobject\nCalled for blessed objects.\n\nSince \"visitobject\" in Data::Visitor will not recurse downwards unless you delegate to\n\"visitref\", you can specify \"visitref\" as the callback for \"object\" in order to enter\nobjects.\n\nIt is recommended that you specify the classes (or base classes) you want though, instead of\njust visiting any object forcefully.\n\nSome::Class\nYou can use any class name as a callback. This is called only after the \"object\" callback.\n\nIf the object \"isa\" the class then the callback will fire.\n\nThese callbacks are called from least derived to most derived by comparing the classes'\n\"isa\" at construction time.\n\nobjectnoclass\nCalled for every object that did not have a class callback.\n\nobjectfinal\nThe last callback called for objects, useful if you want to post process the output of any\nclass callbacks.\n\narray\nCalled for array references.\n\nhash\nCalled for hash references.\n\nglob\nCalled for glob references.\n\nscalar\nCalled for scalar references.\n\ntied\nCalled on the return value of \"tied\" for all tied containers. Also passes in the variable as\nthe second argument.\n\nseen\nCalled for a reference value encountered a second time.\n\nPasses in the result mapping as the second argument.\n",
                "subsections": []
            },
            "SUPPORT": {
                "content": "Bugs may be submitted through the RT bug tracker\n<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Visitor> (or\nbug-Data-Visitor@rt.cpan.org <mailto:bug-Data-Visitor@rt.cpan.org>).\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "*   Yuval Kogman <nothingmuch@woobling.org>\n\n*   Marcel Grünauer <marcel@cpan.org>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENCE": {
                "content": "This software is copyright (c) 2020 by Yuval Kogman.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
                "subsections": []
            }
        }
    }
}