{
    "mode": "info",
    "parameter": "Moose::Cookbook",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/Moose%3A%3ACookbook/json",
    "generated": "2026-07-05T15:42:00Z",
    "sections": {
        "Moose::Cookbook(3pm)  User Contributed Perl Documentation Moose::Cookbook(3pm)": {
            "content": "",
            "subsections": []
        },
        "NAME": {
            "content": "Moose::Cookbook - How to cook a Moose\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.2200\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The Moose cookbook is a series of recipes showing various Moose\nfeatures. Most recipes present some code demonstrating some feature,\nand then explain the details of the code.\n\nYou should probably read the Moose::Manual first. The manual explains\nMoose concepts without being too code-heavy.\n",
            "subsections": []
        },
        "RECIPES": {
            "content": "Basic Moose\nThese recipes will give you a good overview of Moose's capabilities,\nstarting with simple attribute declaration, and moving on to more\npowerful features like laziness, types, type coercion, method\nmodifiers, and more.\n\nMoose::Cookbook::Basics::PointAttributesAndSubclassing\nA simple Moose-based class. Demonstrates basic Moose attributes and\nsubclassing.\n\nMoose::Cookbook::Basics::BankAccountMethodModifiersAndSubclassing\nA slightly more complex Moose class. Demonstrates using a method\nmodifier in a subclass.\n\nMoose::Cookbook::Basics::BinaryTreeAttributeFeatures\nDemonstrates several attribute features, including types, weak\nreferences, predicates (\"does this object have a foo?\"), defaults,\nlaziness, and triggers.\n\nMoose::Cookbook::Basics::CompanySubtypes\nIntroduces the creation and use of custom types, a \"BUILD\" method,\nand the use of \"override\" in a subclass. This recipe also shows how\nto model a set of classes that could be used to model companies,\npeople, employees, etc.\n\nMoose::Cookbook::Basics::HTTPSubtypesAndCoercion\nThis recipe covers more subtype creation, including the use of type\ncoercions.\n\nMoose::Cookbook::Basics::Immutable\nMaking a class immutable greatly increases the speed of accessors\nand object construction.\n\nMoose::Cookbook::Basics::BinaryTreeBuilderAndLazyBuild - Builder\nmethods and lazybuild\nThe builder feature provides an inheritable and role-composable way\nto provide a default attribute value.\n\nMoose::Cookbook::Basics::GenomeOverloadingSubtypesAndCoercion\nDemonstrates using operator overloading, coercion, and subtypes to\nmodel how eye color is determined during reproduction.\n\nMoose::Cookbook::Basics::PersonBUILDARGSAndBUILD\nThis recipe demonstrates the use of \"BUILDARGS\" and \"BUILD\" to hook\ninto object construction.\n\nMoose::Cookbook::Basics::DateTimeExtendingNonMooseParent\nIn this recipe, we make a Moose-based subclass of DateTime, a\nmodule which does not use Moose itself.\n\nMoose::Cookbook::Basics::DocumentAugmentAndInner\nDemonstrates the use of \"augment\" method modifiers, a way of\nturning the usual method overriding style \"inside-out\".\n\nMoose Roles\nThese recipes will show you how to use Moose roles.\n\nMoose::Cookbook::Roles::ComparableCodeReuse\nDemonstrates roles, which are also sometimes known as traits or\nmix-ins. Roles provide a method of code re-use which is orthogonal\nto subclassing.\n\nMoose::Cookbook::Roles::RestartableAdvancedComposition\nSometimes you just want to include part of a role in your class.\nSometimes you want the whole role but one of its methods conflicts\nwith one in your class. With method exclusion and aliasing, you can\nwork around these problems.\n\nMoose::Cookbook::Roles::ApplicationToInstance\nIn this recipe, we apply a role to an existing object instance.\n\nMeta Moose\nThese recipes show you how to write your own meta classes, which lets\nyou extend the object system provided by Moose.\n\nMoose::Cookbook::Meta::WhyMeta\nIf you're wondering what all this \"meta\" stuff is, and why you\nshould care about it, read this \"recipe\".\n\nMoose::Cookbook::Meta::LabeledAttributeTrait\nExtending Moose's attribute metaclass is a great way to add\nfunctionality. However, attributes can only have one metaclass.\nApplying roles to the attribute metaclass lets you provide\ncomposable attribute functionality.\n\nMoose::Cookbook::Meta::TableMetaclassTrait\nThis recipe takes the class metaclass we saw in the previous recipe\nand reimplements it as a metaclass trait.\n\nMoose::Cookbook::Meta::PrivateOrPublicMethodMetaclass\nThis recipe shows a custom method metaclass that implements making\na method private.\n\nMoose::Cookbook::Meta::GlobRefInstanceMetaclass\nThis recipe shows an example of how you create your own meta-\ninstance class. The meta-instance determines the internal structure\nof object instances and provide access to attribute slots.\n\nIn this particular instance, we use a blessed glob reference as the\ninstance instead of a blessed hash reference.\n\nHooking into immutabilization (TODO)\nMoose has a feature known as \"immutabilization\". By calling\n\"PACKAGE->meta()->makeimmutable()\" after defining your class\n(attributes, roles, etc), you tell Moose to optimize things like\nobject creation, attribute access, and so on.\n\nIf you are creating your own metaclasses, you may need to hook into\nthe immutabilization system. This cuts across a number of spots,\nincluding the metaclass class, meta method classes, and possibly\nthe meta-instance class as well.\n\nThis recipe shows you how to write extensions which immutabilize\nproperly.\n\nExtending Moose\nThese recipes cover some more ways to extend Moose, and will be useful\nif you plan to write your own \"MooseX\" module.\n\nMoose::Cookbook::Extending::ExtensionOverview\nThere are quite a few ways to extend Moose. This recipe provides an\noverview of each method, and provides recommendations for when each\nis appropriate.\n\nMoose::Cookbook::Extending::DebuggingBaseClassRole\nMany base object class extensions can be implemented as roles. This\nexample shows how to provide a base object class debugging role\nthat is applied to any class that uses a notional\n\"MooseX::Debugging\" module.\n\nMoose::Cookbook::Extending::MooseishMooseSugar\nThis recipe shows how to provide a replacement for \"Moose.pm\". You\nmay want to do this as part of the API for a \"MooseX\" module,\nespecially if you want to default to a new metaclass class or base\nobject class.\n",
            "subsections": []
        },
        "SNACKS": {
            "content": "Moose::Cookbook::Snack::Keywords\nMoose::Cookbook::Snack::Types\n",
            "subsections": []
        },
        "Legacy Recipes": {
            "content": "These cover topics that are no longer considered best practice. We've\nkept them in case in you encounter these usages in the wild.\n\nMoose::Cookbook::Legacy::LabeledAttributeMetaclass\nMoose::Cookbook::Legacy::TableClassMetaclass\nMoose::Cookbook::Legacy::DebuggingBaseClassReplacement\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "<http://www.gsph.com/index.php?Lang=En&ID=291>\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                      2022-02-06              Moose::Cookbook(3pm)",
            "subsections": []
        }
    },
    "summary": "Moose::Cookbook - How to cook a Moose",
    "flags": [],
    "examples": [],
    "see_also": []
}