{
    "mode": "perldoc",
    "parameter": "Moose::Manual::MooseX",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Moose%3A%3AManual%3A%3AMooseX/json",
    "generated": "2026-06-12T16:58:19Z",
    "sections": {
        "NAME": {
            "content": "Moose::Manual::MooseX - Recommended Moose extensions\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.2200\n\nMooseX?\nIt's easy to extend and change Moose, and this is part of what makes Moose so powerful. You can\nuse the MOP API to do things your own way, add new features, and generally customize your Moose.\n\nWriting your own extensions does require a good understanding of the meta-model. You can start\nlearning about this with the Moose::Manual::MOP docs. There are also several extension recipes\nin the Moose::Cookbook.\n\nExplaining how to write extensions is beyond the scope of this manual. Fortunately, lots of\npeople have already written extensions and put them on CPAN for you.\n\nThis document covers a few of the ones we like best.\n",
            "subsections": []
        },
        "MooseX::AttributeHelpers": {
            "content": "The functionality of this MooseX module has been moved into Moose core. See\nMoose::Meta::Attribute::Native.\n",
            "subsections": []
        },
        "Moose::Autobox": {
            "content": "MooseX::AttributeHelpers, but turned inside out, Moose::Autobox provides methods on both\narrays/hashes/etc. but also references to them, using Moose roles, allowing you do to things\nlike:\n\nuse Moose::Autobox;\n\n$somebodyelsesobject->orders->push($order);\n\nLexically scoped and not to everybody's taste, but very handy for sugaring up other people's\nAPIs and your own code.\n",
            "subsections": []
        },
        "MooseX::StrictConstructor": {
            "content": "By default, Moose lets you pass any old junk into a class's constructor. If you load\nMooseX::StrictConstructor, your class will throw an error if it sees something it doesn't\nrecognize;\n\npackage User;\n\nuse Moose;\nuse MooseX::StrictConstructor;\n\nhas 'name';\nhas 'email';\n\nUser->new( name => 'Bob', emali => 'bob@example.com' );\n\nWith MooseX::StrictConstructor, that typo (\"emali\") will cause a runtime error. With plain old\nMoose, the \"emali\" attribute would be silently ignored.\n",
            "subsections": []
        },
        "MooseX::Params::Validate": {
            "content": "We have high hopes for the future of MooseX::Method::Signatures and Moops. However, these\nmodules, while used regularly in production by some of the more insane members of the community,\nare still marked alpha just in case backwards incompatible changes need to be made.\n\nIf you don't want to risk that, for now we recommend the decidedly more clunky (but also faster\nand simpler) MooseX::Params::Validate. This module lets you apply Moose types and coercions to\nany method arguments.\n\npackage User;\n\nuse Moose;\nuse MooseX::Params::Validate;\n\nsub login {\nmy $self = shift;\nmy ($password)\n= validatedlist( \\@, password => { isa => 'Str', required => 1 } );\n\n...\n}\n",
            "subsections": []
        },
        "MooseX::Getopt": {
            "content": "This is a role which adds a \"newwithoptions\" method to your class. This is a constructor that\ntakes the command line options and uses them to populate attributes.\n\nThis makes writing a command-line application as a module trivially simple:\n\npackage App::Foo;\n\nuse Moose;\nwith 'MooseX::Getopt';\n\nhas 'input' => (\nis       => 'ro',\nisa      => 'Str',\nrequired => 1\n);\n\nhas 'output' => (\nis       => 'ro',\nisa      => 'Str',\nrequired => 1\n);\n\nsub run { ... }\n\nThen in the script that gets run we have:\n\nuse App::Foo;\n\nApp::Foo->newwithoptions->run;\n\nFrom the command line, someone can execute the script:\n\nfoo@example> foo --input /path/to/input --output /path/to/output\n",
            "subsections": []
        },
        "MooseX::Singleton": {
            "content": "To be honest, using a singleton is just a way to have a magic global variable in languages that\ndon't actually have global variables.\n\nIn perl, you can just as easily use a global. However, if your colleagues are Java-infected,\nthey might prefer a singleton. Also, if you have an existing class that *isn't* a singleton but\nshould be, using MooseX::Singleton is the easiest way to convert it.\n\npackage Config;\n\nuse MooseX::Singleton; # instead of Moose\n\nhas 'cachedir' => ( ... );\n\nIt's that simple.\n",
            "subsections": []
        },
        "EXTENSIONS TO CONSIDER": {
            "content": "There are literally dozens of other extensions on CPAN. This is a list of extensions that you\nmight find useful, but we're not quite ready to endorse just yet.\n",
            "subsections": [
                {
                    "name": "MooseX::Declare",
                    "content": "MooseX::Declare is based on Devel::Declare, a giant bag of crack originally implemented by mst\nwith the goal of upsetting the perl core developers so much by its very existence that they\nimplemented proper keyword handling in the core.\n\nAs of perl5 version 14, this goal has been achieved, and modules such as Devel::CallParser,\nFunction::Parameters, and Keyword::Simple provide mechanisms to mangle perl syntax that don't\nrequire hallucinogenic drugs to interpret the error messages they produce.\n\nIf you want to use declarative syntax in new code, please for the love of kittens get yourself a\nrecent perl and look at Moops instead.\n"
                },
                {
                    "name": "MooseX::Types",
                    "content": "This extension helps you build a type library for your application. It also lets you predeclare\ntype names and use them as barewords.\n\nuse MooseX::Types -declare => ['PositiveInt'];\nuse MooseX::Types::Moose 'Int';\n\nsubtype PositiveInt,\nas Int,\nwhere { $ > 0 },\nmessage { \"Int is not larger than 0\" };\n\nOne nice feature is that those bareword names are actually namespaced in Moose's type registry,\nso multiple applications can use the same bareword names, even if the type definitions differ.\n"
                },
                {
                    "name": "MooseX::Types::Structured",
                    "content": "This extension builds on top of MooseX::Types to let you declare complex data structure types.\n\nuse MooseX::Types -declare => [ qw( Name Color ) ];\nuse MooseX::Types::Moose qw(Str Int);\nuse MooseX::Types::Structured qw(Dict Tuple Optional);\n\nsubtype Name\n=> as Dict[ first => Str, middle => Optional[Str], last => Str ];\n\nsubtype Color\n=> as Tuple[ Int, Int, Int, Optional[Int] ];\n\nOf course, you could always use objects to represent these sorts of things too.\n"
                },
                {
                    "name": "MooseX::ClassAttribute",
                    "content": "This extension provides class attributes for Moose classes. The declared class attributes are\nintrospectable just like regular Moose attributes.\n\npackage User;\n\nuse Moose;\nuse MooseX::ClassAttribute;\n\nhas 'name' => ( ... );\n\nclasshas 'Cache' => ( ... );\n\nNote however that this class attribute does *not* inherit like a Class::Data::Inheritable or\nsimilar attribute - calling\n\n$subclass->Cache($cache);\n\nwill set it for the superclass as well. Additionally, class data is usually The Wrong Thing To\nDo in a strongly OO program since it makes testing a lot harder - consider carefully whether\nyou'd be better off with an object that's passed around instead.\n"
                },
                {
                    "name": "MooseX::Daemonize",
                    "content": "This is a role that provides a number of methods useful for creating a daemon, including methods\nfor starting and stopping, managing a PID file, and signal handling.\n"
                },
                {
                    "name": "MooseX::Role::Parameterized",
                    "content": "If you find yourself wanting a role that customizes itself for each consumer, this is the tool\nfor you. With this module, you can create a role that accepts parameters and generates\nattributes, methods, etc. on a customized basis for each consumer.\n"
                },
                {
                    "name": "MooseX::POE",
                    "content": "This is a small wrapper that ties together a Moose class with \"POE::Session\", and gives you an\n\"event\" sugar function to declare event handlers.\n"
                },
                {
                    "name": "MooseX::FollowPBP",
                    "content": "Automatically names all accessors *Perl Best Practices*-style, \"getsize\" and \"setsize\".\n"
                },
                {
                    "name": "MooseX::SemiAffordanceAccessor",
                    "content": "Automatically names all accessors with an explicit set and implicit get, \"size\" and \"setsize\".\n"
                },
                {
                    "name": "MooseX::NonMoose",
                    "content": "MooseX::NonMoose allows for easily subclassing non-Moose classes with Moose, taking care of the\nannoying details connected with doing this, such as setting up proper inheritance from\nMoose::Object and installing (and inlining, at makeimmutable time) a constructor that makes\nsure things like BUILD methods are called.\n"
                }
            ]
        },
        "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": []
        }
    },
    "summary": "Moose::Manual::MooseX - Recommended Moose extensions",
    "flags": [],
    "examples": [],
    "see_also": []
}