{
    "content": [
        {
            "type": "text",
            "text": "# Class::ErrorHandler (perldoc)\n\n## NAME\n\nClass::ErrorHandler - Base class for error handling\n\n## SYNOPSIS\n\npackage Foo;\nuse base qw( Class::ErrorHandler );\nsub classmethod {\nmy $class = shift;\n...\nreturn $class->error(\"Help!\")\nunless $continue;\n}\nsub objectmethod {\nmy $obj = shift;\n...\nreturn $obj->error(\"I am no more\")\nunless $continue;\n}\npackage main;\nuse Foo;\nFoo->classmethod or die Foo->errstr;\nmy $foo = Foo->new;\n$foo->objectmethod or die $foo->errstr;\n\n## DESCRIPTION\n\n*Class::ErrorHandler* provides an error-handling mechanism that's generic enough to be used as\nthe base class for a variety of OO classes. Subclasses inherit its two error-handling methods,\n*error* and *errstr*, to communicate error messages back to the calling program.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **USAGE**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Class::ErrorHandler",
        "section": "",
        "mode": "perldoc",
        "summary": "Class::ErrorHandler - Base class for error handling",
        "synopsis": "package Foo;\nuse base qw( Class::ErrorHandler );\nsub classmethod {\nmy $class = shift;\n...\nreturn $class->error(\"Help!\")\nunless $continue;\n}\nsub objectmethod {\nmy $obj = shift;\n...\nreturn $obj->error(\"I am no more\")\nunless $continue;\n}\npackage main;\nuse Foo;\nFoo->classmethod or die Foo->errstr;\nmy $foo = Foo->new;\n$foo->objectmethod or die $foo->errstr;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "USAGE",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Class::ErrorHandler - Base class for error handling\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package Foo;\nuse base qw( Class::ErrorHandler );\n\nsub classmethod {\nmy $class = shift;\n...\nreturn $class->error(\"Help!\")\nunless $continue;\n}\n\nsub objectmethod {\nmy $obj = shift;\n...\nreturn $obj->error(\"I am no more\")\nunless $continue;\n}\n\npackage main;\nuse Foo;\n\nFoo->classmethod or die Foo->errstr;\n\nmy $foo = Foo->new;\n$foo->objectmethod or die $foo->errstr;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "*Class::ErrorHandler* provides an error-handling mechanism that's generic enough to be used as\nthe base class for a variety of OO classes. Subclasses inherit its two error-handling methods,\n*error* and *errstr*, to communicate error messages back to the calling program.\n\nOn failure (for whatever reason), a subclass should call *error* and return to the caller;\n*error* itself sets the error message internally, then returns \"undef\". This has the effect of\nthe method that failed returning \"undef\" to the caller. The caller should check for errors by\nchecking for a return value of \"undef\", and calling *errstr* to get the value of the error\nmessage on an error.\n\nAs demonstrated in the SYNOPSIS, *error* and *errstr* work as both class methods and object\nmethods.\n",
                "subsections": []
            },
            "USAGE": {
                "content": "Class->error($message)\n$object->error($message)\nSets the error message for either the class *Class* or the object *$object* to the message\n*$message*. Returns \"undef\".\n\nClass->errstr\n$object->errstr\nAccesses the last error message set in the class *Class* or the object *$object*, respectively,\nand returns that error message.\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "This library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\nAUTHOR & COPYRIGHT\nExcept where otherwise noted, *Class::ErrorHandler* is Copyright 2004 Benjamin Trott,\ncpan@stupidfool.org. All rights reserved.\n",
                "subsections": []
            }
        }
    }
}