{
    "content": [
        {
            "type": "text",
            "text": "# Moose::Cookbook::Extending::Mooseish_MooseSugar (perldoc)\n\n## NAME\n\nMoose::Cookbook::Extending::MooseishMooseSugar - Acting like Moose.pm and providing sugar Moose-style\n\n## SYNOPSIS\n\npackage MyApp::Mooseish;\nuse Moose::Exporter;\nMoose::Exporter->setupimportmethods(\nwithmeta       => ['hastable'],\nclassmetaroles => {\nclass => ['MyApp::Meta::Class::Trait::HasTable'],\n},\n);\nsub hastable {\nmy $meta = shift;\n$meta->table(shift);\n}\npackage MyApp::Meta::Class::Trait::HasTable;\nuse Moose::Role;\nhas table => (\nis  => 'rw',\nisa => 'Str',\n);\n\n## DESCRIPTION\n\nThis recipe expands on the use of Moose::Exporter we saw in\nMoose::Cookbook::Extending::ExtensionOverview and the class metaclass trait we saw in\nMoose::Cookbook::Meta::TableMetaclassTrait. In this example we provide our own metaclass trait,\nand we also export a \"hastable\" sugar function.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CONCLUSION**\n- **AUTHORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Moose::Cookbook::Extending::Mooseish_MooseSugar",
        "section": "",
        "mode": "perldoc",
        "summary": "Moose::Cookbook::Extending::MooseishMooseSugar - Acting like Moose.pm and providing sugar Moose-style",
        "synopsis": "package MyApp::Mooseish;\nuse Moose::Exporter;\nMoose::Exporter->setupimportmethods(\nwithmeta       => ['hastable'],\nclassmetaroles => {\nclass => ['MyApp::Meta::Class::Trait::HasTable'],\n},\n);\nsub hastable {\nmy $meta = shift;\n$meta->table(shift);\n}\npackage MyApp::Meta::Class::Trait::HasTable;\nuse Moose::Role;\nhas table => (\nis  => 'rw',\nisa => 'Str',\n);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "CONCLUSION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Moose::Cookbook::Extending::MooseishMooseSugar - Acting like Moose.pm and providing sugar\nMoose-style\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 2.2200\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package MyApp::Mooseish;\n\nuse Moose::Exporter;\n\nMoose::Exporter->setupimportmethods(\nwithmeta       => ['hastable'],\nclassmetaroles => {\nclass => ['MyApp::Meta::Class::Trait::HasTable'],\n},\n);\n\nsub hastable {\nmy $meta = shift;\n$meta->table(shift);\n}\n\npackage MyApp::Meta::Class::Trait::HasTable;\nuse Moose::Role;\n\nhas table => (\nis  => 'rw',\nisa => 'Str',\n);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This recipe expands on the use of Moose::Exporter we saw in\nMoose::Cookbook::Extending::ExtensionOverview and the class metaclass trait we saw in\nMoose::Cookbook::Meta::TableMetaclassTrait. In this example we provide our own metaclass trait,\nand we also export a \"hastable\" sugar function.\n\nThe \"withmeta\" parameter specifies a list of functions that should be wrapped before exporting.\nThe wrapper simply ensures that the importing package's appropriate metaclass object is the\nfirst argument to the function, so we can do \"my $meta = shift;\".\n\nSee the Moose::Exporter docs for more details on its API.\n\nUSING MyApp::Mooseish\nThe purpose of all this code is to provide a Moose-like interface. Here's what it would look\nlike in actual use:\n\npackage MyApp::User;\n\nuse namespace::autoclean;\n\nuse Moose;\nuse MyApp::Mooseish;\n\nhastable 'User';\n\nhas 'username' => ( is => 'ro' );\nhas 'password' => ( is => 'ro' );\n\nsub login { ... }\n",
                "subsections": []
            },
            "CONCLUSION": {
                "content": "Providing sugar functions can make your extension look much more Moose-ish. See Fey::ORM for a\nmore extensive example.\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": []
            }
        }
    }
}