{
    "content": [
        {
            "type": "text",
            "text": "# Moose::Role (perldoc)\n\n## NAME\n\nMoose::Role - The Moose Role\n\n## SYNOPSIS\n\npackage Eq;\nuse Moose::Role; # automatically turns on strict and warnings\nrequires 'equal';\nsub noequal {\nmy ($self, $other) = @;\n!$self->equal($other);\n}\n# ... then in your classes\npackage Currency;\nuse Moose; # automatically turns on strict and warnings\nwith 'Eq';\nsub equal {\nmy ($self, $other) = @;\n$self->asfloat == $other->asfloat;\n}\n# ... and also\npackage Comparator;\nuse Moose;\nhas compareto => (\nis      => 'ro',\ndoes    => 'Eq',\nhandles => 'Eq',\n);\n# ... which allows\nmy $currency1 = Currency->new(...);\nmy $currency2 = Currency->new(...);\nComparator->new(compareto => $currency1)->equal($currency2);\n\n## DESCRIPTION\n\nThe concept of roles is documented in Moose::Manual::Roles. This document serves as API\ndocumentation.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **EXPORTED FUNCTIONS**\n- **METACLASS**\n- **APPLYING ROLES**\n- **CAVEATS**\n- **BUGS**\n- **AUTHORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Moose::Role",
        "section": "",
        "mode": "perldoc",
        "summary": "Moose::Role - The Moose Role",
        "synopsis": "package Eq;\nuse Moose::Role; # automatically turns on strict and warnings\nrequires 'equal';\nsub noequal {\nmy ($self, $other) = @;\n!$self->equal($other);\n}\n# ... then in your classes\npackage Currency;\nuse Moose; # automatically turns on strict and warnings\nwith 'Eq';\nsub equal {\nmy ($self, $other) = @;\n$self->asfloat == $other->asfloat;\n}\n# ... and also\npackage Comparator;\nuse Moose;\nhas compareto => (\nis      => 'ro',\ndoes    => 'Eq',\nhandles => 'Eq',\n);\n# ... which allows\nmy $currency1 = Currency->new(...);\nmy $currency2 = Currency->new(...);\nComparator->new(compareto => $currency1)->equal($currency2);",
        "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": 39,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "EXPORTED FUNCTIONS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "METACLASS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "APPLYING ROLES",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "CAVEATS",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Moose::Role - The Moose Role\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 2.2200\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package Eq;\nuse Moose::Role; # automatically turns on strict and warnings\n\nrequires 'equal';\n\nsub noequal {\nmy ($self, $other) = @;\n!$self->equal($other);\n}\n\n# ... then in your classes\n\npackage Currency;\nuse Moose; # automatically turns on strict and warnings\n\nwith 'Eq';\n\nsub equal {\nmy ($self, $other) = @;\n$self->asfloat == $other->asfloat;\n}\n\n# ... and also\n\npackage Comparator;\nuse Moose;\n\nhas compareto => (\nis      => 'ro',\ndoes    => 'Eq',\nhandles => 'Eq',\n);\n\n# ... which allows\n\nmy $currency1 = Currency->new(...);\nmy $currency2 = Currency->new(...);\nComparator->new(compareto => $currency1)->equal($currency2);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The concept of roles is documented in Moose::Manual::Roles. This document serves as API\ndocumentation.\n",
                "subsections": []
            },
            "EXPORTED FUNCTIONS": {
                "content": "Moose::Role currently supports all of the functions that Moose exports, but differs slightly in\nhow some items are handled (see \"CAVEATS\" below for details).\n\nMoose::Role also offers two role-specific keyword exports:\n\nrequires (@methodnames)\nRoles can require that certain methods are implemented by any class which \"does\" the role.\n\nNote that attribute accessors also count as methods for the purposes of satisfying the\nrequirements of a role.\n\nexcludes (@rolenames)\nRoles can \"exclude\" other roles, in effect saying \"I can never be combined with these\n@rolenames\". This is a feature which should not be used lightly.\n\nno Moose::Role\nMoose::Role offers a way to remove the keywords it exports, through the \"unimport\" method. You\nsimply have to say \"no Moose::Role\" at the bottom of your code for this to work.\n",
                "subsections": []
            },
            "METACLASS": {
                "content": "When you use Moose::Role, you can specify traits which will be applied to your role metaclass:\n\nuse Moose::Role -traits => 'My::Trait';\n\nThis is very similar to the attribute traits feature. When you do this, your class's \"meta\"\nobject will have the specified traits applied to it. See \"Metaclass and Trait Name Resolution\"\nin Moose for more details.\n\nAll role metaclasses (note, not the role itself) extend Moose::Meta::Role. You can test if a\npackage is a role or not using \"isrole\" in Moose::Util.\n",
                "subsections": []
            },
            "APPLYING ROLES": {
                "content": "In addition to being applied to a class using the 'with' syntax (see Moose::Manual::Roles) and\nusing the Moose::Util 'applyallroles' method, roles may also be applied to an instance of a\nclass using Moose::Util 'applyallroles' or the role's metaclass:\n\nMyApp::Test::SomeRole->meta->apply( $instance );\n\nDoing this creates a new, mutable, anonymous subclass, applies the role to that, and reblesses.\nIn a debugger, for example, you will see class names of the form \"\nMoose::Meta::Class::ANON::SERIAL::6 \", which means that doing a 'ref' on your instance may\nnot return what you expect. See Moose::Object for 'DOES'.\n\nAdditional params may be added to the new instance by providing 'reblessparams'. See\nMoose::Meta::Role::Application::ToInstance.\n",
                "subsections": []
            },
            "CAVEATS": {
                "content": "Role support has only a few caveats:\n\n*   Roles cannot use the \"extends\" keyword; it will throw an exception for now. The same is true\nof the \"augment\" and \"inner\" keywords (not sure those really make sense for roles). All\nother Moose keywords will be *deferred* so that they can be applied to the consuming class.\n\n*   Role composition does its best to not be order-sensitive when it comes to conflict\nresolution and requirements detection. However, it is order-sensitive when it comes to\nmethod modifiers. All before/around/after modifiers are included whenever a role is composed\ninto a class, and then applied in the order in which the roles are used. This also means\nthat there is no conflict for before/around/after modifiers.\n\nIn most cases, this will be a non-issue; however, it is something to keep in mind when using\nmethod modifiers in a role. You should never assume any ordering.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "See \"BUGS\" in Moose for details on reporting bugs.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "*   Stevan Little <stevan@cpan.org>\n\n*   Dave Rolsky <autarch@urth.org>\n\n*   Jesse Luehrs <doy@cpan.org>\n\n*   Shawn M Moore <sartak@cpan.org>\n\n*   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>\n\n*   Karen Etheridge <ether@cpan.org>\n\n*   Florian Ragwitz <rafl@debian.org>\n\n*   Hans Dieter Pearcey <hdp@cpan.org>\n\n*   Chris Prather <chris@prather.org>\n\n*   Matt S Trout <mstrout@cpan.org>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "This software is copyright (c) 2006 by Infinity Interactive, Inc.\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": []
            }
        }
    }
}