{
    "mode": "perldoc",
    "parameter": "Carp::Clan",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Carp%3A%3AClan/json",
    "generated": "2026-07-06T08:56:51Z",
    "synopsis": "carp    - warn of errors (from perspective of caller)\ncluck   - warn of errors with stack backtrace\ncroak   - die of errors (from perspective of caller)\nconfess - die of errors with stack backtrace\nuse Carp::Clan qw(^MyClan::);\ncroak \"We're outta here!\";\nuse Carp::Clan;\nconfess \"This is how we got here!\";",
    "sections": {
        "NAME": {
            "content": "Carp::Clan - Report errors from perspective of caller of a \"clan\" of modules\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 6.08\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "carp    - warn of errors (from perspective of caller)\n\ncluck   - warn of errors with stack backtrace\n\ncroak   - die of errors (from perspective of caller)\n\nconfess - die of errors with stack backtrace\n\nuse Carp::Clan qw(^MyClan::);\ncroak \"We're outta here!\";\n\nuse Carp::Clan;\nconfess \"This is how we got here!\";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module is based on \"\"Carp.pm\"\" from Perl 5.00503. It has been modified to skip all package\nnames matching the pattern given in the \"use\" statement inside the \"\"qw()\"\" term (or argument\nlist).\n\nSuppose you have a family of modules or classes named \"Pack::A\", \"Pack::B\" and so on, and each\nof them uses \"\"Carp::Clan qw(^Pack::);\"\" (or at least the one in which the error or warning gets\nraised).\n\nThus when for example your script \"tool.pl\" calls module \"Pack::A\", and module \"Pack::A\" calls\nmodule \"Pack::B\", an exception raised in module \"Pack::B\" will appear to have originated in\n\"tool.pl\" where \"Pack::A\" was called, and not in \"Pack::A\" where \"Pack::B\" was called, as the\nunmodified \"\"Carp.pm\"\" would try to make you believe \":-)\".\n\nThis works similarly if \"Pack::B\" calls \"Pack::C\" where the exception is raised, et cetera.\n\nIn other words, this blames all errors in the \"\"Pack::*\"\" modules on the user of these modules,\ni.e., on you. \";-)\"\n\nThe skipping of a clan (or family) of packages according to a pattern describing its members is\nnecessary in cases where these modules are not classes derived from each other (and thus when\nexamining @ISA - as in the original \"\"Carp.pm\"\" module - doesn't help).\n\nThe purpose and advantage of this is that a \"clan\" of modules can work together (and call each\nother) and throw exceptions at various depths down the calling hierarchy and still appear as a\nmonolithic block (as though they were a single module) from the perspective of the caller.\n\nIn case you just want to ward off all error messages from the module in which you \"\"use\nCarp::Clan\"\", i.e., if you want to make all error messages or warnings to appear to originate\nfrom where your module was called (this is what you usually used to \"\"use Carp;\"\" for \";-)\"),\ninstead of in your module itself (which is what you can do with a \"die\" or \"warn\" anyway), you\ndo not need to provide a pattern, the module will automatically provide the correct one for you.\n\nI.e., just \"\"use Carp::Clan;\"\" without any arguments and call \"carp\" or \"croak\" as appropriate,\nand they will automatically defend your module against all blames!\n\nIn other words, a pattern is only necessary if you want to make several modules (more than one)\nwork together and appear as though they were only one.\n",
            "subsections": [
                {
                    "name": "Forcing a Stack Trace",
                    "content": "As a debugging aid, you can force \"\"Carp::Clan\"\" to treat a \"croak\" as a \"confess\" and a \"carp\"\nas a \"cluck\". In other words, force a detailed stack trace to be given. This can be very helpful\nwhen trying to understand why, or from where, a warning or error is being generated.\n\nThis feature is enabled either by \"importing\" the non-existent symbol 'verbose', or by setting\nthe global variable \"$Carp::Clan::Verbose\" to a true value.\n\nYou would typically enable it by saying\n\nuse Carp::Clan qw(verbose);\n\nNote that you can both specify a \"family pattern\" and the string \"verbose\" inside the \"\"qw()\"\"\nterm (or argument list) of the \"use\" statement, but consider that a pattern of packages to skip\nis pointless when \"verbose\" causes a full stack trace anyway.\n"
                }
            ]
        },
        "BUGS": {
            "content": "The \"\"Carp::Clan\"\" routines don't handle exception objects currently. If called with a first\nargument that is a reference, they simply call \"\"die()\"\" or \"\"warn()\"\", as appropriate.\n\nBugs may be submitted through the RT bug tracker\n<https://rt.cpan.org/Public/Dist/Display.html?Name=Carp-Clan> (or bug-Carp-Clan@rt.cpan.org\n<mailto:bug-Carp-Clan@rt.cpan.org>).\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Steffen Beyer <STBEY@cpan.org>\n",
            "subsections": []
        },
        "CONTRIBUTORS": {
            "content": "*   Karen Etheridge <ether@cpan.org>\n\n*   Joshua ben Jore <jjore@cpan.org>\n\n*   Kent Fredric <kentnl@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2001 by Steffen Beyer, Joshua ben Jore.\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": []
        }
    },
    "summary": "Carp::Clan - Report errors from perspective of caller of a \"clan\" of modules",
    "flags": [],
    "examples": [],
    "see_also": []
}