{
    "content": [
        {
            "type": "text",
            "text": "# GD::Graph::Error (perldoc)\n\n## NAME\n\nGD::Graph::Error - Error handling for GD::Graph classes\n\n## SYNOPSIS\n\nuse GD::Graph::Errorsubclass;\n\n## DESCRIPTION\n\nThis class is a parent for all GD::Graph classes, including GD::Graph::Data, and offers error\nand warning handling and some debugging control.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PUBLIC METHODS**\n- **PROTECTED METHODS**\n- **VARIABLES**\n- **NOTES**\n- **AUTHOR** (1 subsections)\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "GD::Graph::Error",
        "section": "",
        "mode": "perldoc",
        "summary": "GD::Graph::Error - Error handling for GD::Graph classes",
        "synopsis": "use GD::Graph::Errorsubclass;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "PUBLIC METHODS",
                "lines": 55,
                "subsections": []
            },
            {
                "name": "PROTECTED METHODS",
                "lines": 21,
                "subsections": []
            },
            {
                "name": "VARIABLES",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Copyright",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "GD::Graph::Error - Error handling for GD::Graph classes\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use GD::Graph::Errorsubclass;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This class is a parent for all GD::Graph classes, including GD::Graph::Data, and offers error\nand warning handling and some debugging control.\n\nErrors are stored in a lexical hash in this package, so the implementation of the subclass\nshould be irrelevant.\n",
                "subsections": []
            },
            "PUBLIC METHODS": {
                "content": "These methods can be used by users of any of the subclasses of GD::Graph::Error to get at the\nerrors of objects or classes.\n\n$object->error() OR Class->error()\nReturns a list of all the errors that the current object has accumulated. In scalar context,\nreturns the last error. If called as a class method it works at a class level. This is handy\nwhen a constructor fails, for example:\n\nmy $data = GD::Graph::Data->new()\nor die GD::Graph::Data->error;\n$data->read(file => '/foo/bar.data')\nor die $data->error;\n\nor if you really are only interested in the last error:\n\n$data->read(file => '/foo/bar.data')\nor die scalar $data->error;\n\nThis implementation does not clear the error list, so if you don't die on errors, you will need\nto make sure to never ask for anything but the last error (put this in scalar context) or to\ncall \"clearerror()\" now and again.\n\nErrors are more verbose about where the errors originated if the $GD::Graph::Error::Debug\nvariable is set to a true value, and even more verbose if this value is larger than 5.\n\nIf $Debug is larger than 3, both of these will always return the full list of errors and\nwarnings (although the meaning of \"haswarning\" and \"haserror\" does not change).\n\n$object->haserror() OR Class->haserror()\n$object->haswarning() OR Class->haswarning()\nReturns true if there are pending errors (warnings) for the object (or class). To be more\nprecise, it returns a list of errors in list context, and the number of errors in scalar\ncontext.\n\nThis allows you to check for errors and warnings after a large number of operations which each\nmight fail:\n\n$data->read(file => '/foo/bar.data') or die $data->error;\nwhile (my @foo = $sth->fetchrowarray)\n{\n$data->addpoint(@foo);\n}\n$data->setx(12, 'Foo');\n$data->haswarning and warn $data->warning;\n$data->haserror   and die  $data->error;\n\nThe reason to call this, instead of just calling \"error()\" or \"warning()\" and looking at its\nreturn value, is that this method is much more efficient and fast.\n\nIf you want to count anything as bad, just set $ErrorLevel to 0, after which you only need to\ncall \"haserror\".\n\n$object->clearerrors() or Class->clearerrors()\nClears all outstanding errors.\n",
                "subsections": []
            },
            "PROTECTED METHODS": {
                "content": "These methods are only to be called from within this class and its Subclasses.\n\n$object->seterror(*arg*) or Class->seterror(*arg*)\n$object->setwarning(*arg*) or Class->setwarning(*arg*)\nSubclasses call this to set an error. The argument can be a reference to an array, of which the\nfirst element should be the error level, and the second element the error message.\nAlternatively, it can just be the message, in which case the error level will be assumed to be\n$ErrorLevel.\n\nIf the error level is >= $CriticalLevel the program will die, using Carp::croak to display the\ncurrent message, as well as all the other error messages pending.\n\nIn the current implementation these are almost identical when called with a scalar argument,\nexcept that the default error level is different. When called with an array reference, they are\nidentical in function. This may change in the future. They're mainly here for code clarity.\n\n$object->moveerrors\nMove errors from an object into the class it belongs to. This can be useful if something nasty\nhappens in the constructor, while instantiating one of these objects, and you need to move these\nerrors into the class space before returning. (see GD::Graph::Data::new for an example)\n",
                "subsections": []
            },
            "VARIABLES": {
                "content": "$GD::Graph::Error::Debug\nThe higher this value, the more verbose error messages will be. At the moment, any true value\nwill cause the line number and source file of the caller at the top of the stack to be included,\na value of more than 2 will include the error severity, and a value of more than 5 will also\ninclude the direct caller's (i.e. the spot where the error message was generated) line number\nand package. Default: 0.\n\n$GD::Graph::Error::ErrorLevel\nErrors levels below this value will be counted as warnings, and error levels above (and\ninclusive) up to $CriticalLevel will be counted as errors. This is also the default error level\nfor the \"seterror()\" method. This value should be 0 or larger, and smaller than\n$CriticalLevel. Default: 5.\n\n$GD::Graph::Error::CriticalLevel\nAny errorlevel of or above this level will immediately cause the program to die with the\nspecified message, using Carp::croak. Default: 10.\n",
                "subsections": []
            },
            "NOTES": {
                "content": "As with all Modules for Perl: Please stick to using the interface. If you try to fiddle too much\nwith knowledge of the internals of this module, you could get burned. I may change them at any\ntime.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Martien Verbruggen <mgjv@tradingpost.com.au>\n",
                "subsections": [
                    {
                        "name": "Copyright",
                        "content": "(c) Martien Verbruggen.\n\nAll rights reserved. This package is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "GD::Graph, GD::Graph::Data\n",
                "subsections": []
            }
        }
    }
}