{
    "content": [
        {
            "type": "text",
            "text": "# Moose::Cookbook::Legacy::Table_ClassMetaclass (info)\n\n## NAME\n\nMoose::Cookbook::Legacy::TableClassMetaclass - Adding a \"table\" attribute to the metaclass\n\n## SYNOPSIS\n\npackage MyApp::Meta::Class;\nuse Moose;\nextends 'Moose::Meta::Class';\nhas table => (\nis  => 'rw',\nisa => 'Str',\n);\n\n## DESCRIPTION\n\nWARNING: Subclassing metaclasses (as opposed to providing metaclass\ntraits) is strongly discouraged. This recipe is provided solely for\nreference when encountering older code that does this.\n\n## Sections\n\n- **Moose::Cookbook::LegacUseraCMoose::Cookbook::Legacy::TableClassMetaclass(3pm)**\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **THE METACLASS**\n- **CONCLUSION**\n- **SEE ALSO**\n- **AUTHORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Moose::Cookbook::Legacy::Table_ClassMetaclass",
        "section": "",
        "mode": "info",
        "summary": "Moose::Cookbook::Legacy::TableClassMetaclass - Adding a \"table\" attribute to the metaclass",
        "synopsis": "package MyApp::Meta::Class;\nuse Moose;\nextends 'Moose::Meta::Class';\nhas table => (\nis  => 'rw',\nisa => 'Str',\n);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "Moose::Cookbook::LegacUseraCMoose::Cookbook::Legacy::TableClassMetaclass(3pm)",
                "lines": 1,
                "subsections": []
            },
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "THE METACLASS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "CONCLUSION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "Moose::Cookbook::LegacUseraCMoose::Cookbook::Legacy::TableClassMetaclass(3pm)": {
                "content": "",
                "subsections": []
            },
            "NAME": {
                "content": "Moose::Cookbook::Legacy::TableClassMetaclass - Adding a \"table\"\nattribute to the metaclass\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 2.2200\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package MyApp::Meta::Class;\nuse Moose;\nextends 'Moose::Meta::Class';\n\nhas table => (\nis  => 'rw',\nisa => 'Str',\n);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "WARNING: Subclassing metaclasses (as opposed to providing metaclass\ntraits) is strongly discouraged. This recipe is provided solely for\nreference when encountering older code that does this.\n\nIn this recipe, we'll create a new metaclass which has a \"table\"\nattribute. This metaclass is for classes associated with a DBMS table,\nas one might do for an ORM.\n\nIn this example, the table name is just a string, but in a real ORM the\ntable might be an object describing the table.\n",
                "subsections": []
            },
            "THE METACLASS": {
                "content": "This really is as simple as the recipe \"SYNOPSIS\" shows. The trick is\ngetting your classes to use this metaclass, and providing some sort of\nsugar for declaring the table. This is covered in\nMoose::Cookbook::Extending::Recipe2, which shows how to make a module\nlike \"Moose.pm\" itself, with sugar like \"hastable()\".\n\nUsing this Metaclass in Practice\nAccessing this new \"table\" attribute is quite simple. Given a class\nnamed \"MyApp::User\", we could simply write the following:\n\nmy $table = MyApp::User->meta->table;\n\nAs long as \"MyApp::User\" has arranged to use \"MyApp::Meta::Class\" as\nits metaclass, this method call just works. If we want to be more\ncareful, we can check the metaclass's class:\n\n$table = MyApp::User->meta->table\nif MyApp::User->meta->isa('MyApp::Meta::Class');\n",
                "subsections": []
            },
            "CONCLUSION": {
                "content": "Creating custom metaclass is trivial. Using it is a little harder, and\nis covered in other recipes. We will also talk about applying traits to\na class metaclass, which is a more flexible and cooperative\nimplementation.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Moose::Cookbook::Meta::Recipe5 - The \"table\" attribute implemented as a\nmetaclass trait\n\nMoose::Cookbook::Extending::Recipe2 - Acting like Moose.pm and\nproviding sugar Moose-style\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "o   Stevan Little <stevan@cpan.org>\n\no   Dave Rolsky <autarch@urth.org>\n\no   Jesse Luehrs <doy@cpan.org>\n\no   Shawn M Moore <sartak@cpan.org>\n\no    ' (Yuval Kogman) <nothingmuch@woobling.org>\n\no   Karen Etheridge <ether@cpan.org>\n\no   Florian Ragwitz <rafl@debian.org>\n\no   Hans Dieter Pearcey <hdp@cpan.org>\n\no   Chris Prather <chris@prather.org>\n\no   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\nthe same terms as the Perl 5 programming language system itself.\n\nperl v5.34.0                Moose::Cookbook::Legacy::TableClassMetaclass(3pm)",
                "subsections": []
            }
        }
    }
}