{"id":29228983,"url":"https://github.com/xslate/p5-Mouse","last_synced_at":"2025-07-03T11:05:32.584Z","repository":{"id":3763182,"uuid":"4839485","full_name":"xslate/p5-Mouse","owner":"xslate","description":"Lightweight class builder for Perl, as a subset of Moose","archived":false,"fork":false,"pushed_at":"2024-08-04T11:38:53.000Z","size":4935,"stargazers_count":46,"open_issues_count":20,"forks_count":32,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-06-28T10:53:51.326Z","etag":null,"topics":["moose","p5-class-builder","perl5"],"latest_commit_sha":null,"homepage":"https://metacpan.org/release/Mouse","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xslate.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-06-30T03:28:35.000Z","updated_at":"2024-08-04T11:38:54.000Z","dependencies_parsed_at":"2024-06-18T10:43:00.063Z","dependency_job_id":"1877d944-05f0-438a-8faa-3a3ba864b0dd","html_url":"https://github.com/xslate/p5-Mouse","commit_stats":{"total_commits":2032,"total_committers":53,"mean_commits":"38.339622641509436","dds":0.4104330708661418,"last_synced_commit":"5537dc8633eaebb9ae36e67194e07faeac8538ed"},"previous_names":["gfx/p5-mouse"],"tags_count":139,"template":false,"template_full_name":null,"purl":"pkg:github/xslate/p5-Mouse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xslate%2Fp5-Mouse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xslate%2Fp5-Mouse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xslate%2Fp5-Mouse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xslate%2Fp5-Mouse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xslate","download_url":"https://codeload.github.com/xslate/p5-Mouse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xslate%2Fp5-Mouse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263314240,"owners_count":23447295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["moose","p5-class-builder","perl5"],"created_at":"2025-07-03T11:05:31.114Z","updated_at":"2025-07-03T11:05:32.573Z","avatar_url":"https://github.com/xslate.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nMouse - Moose minus the antlers\n\n# VERSION\n\nThis document describes Mouse version v2.5.11\n\n# SYNOPSIS\n\n    package Point;\n    use Mouse; # automatically turns on strict and warnings\n\n    has 'x' =\u003e (is =\u003e 'rw', isa =\u003e 'Int');\n    has 'y' =\u003e (is =\u003e 'rw', isa =\u003e 'Int');\n\n    sub clear {\n        my($self) = @_;\n        $self-\u003ex(0);\n        $self-\u003ey(0);\n    }\n\n\n    __PACKAGE__-\u003emeta-\u003emake_immutable();\n\n    package Point3D;\n    use Mouse;\n\n    extends 'Point';\n\n    has 'z' =\u003e (is =\u003e 'rw', isa =\u003e 'Int');\n\n    after 'clear' =\u003e sub {\n        my($self) = @_;\n        $self-\u003ez(0);\n    };\n\n    __PACKAGE__-\u003emeta-\u003emake_immutable();\n\n# DESCRIPTION\n\n[Moose](https://metacpan.org/pod/Moose) is a postmodern object system for Perl5. Moose is wonderful.\n\nUnfortunately, Moose has a compile-time penalty. Though significant progress\nhas been made over the years, the compile time penalty is a non-starter for\nsome very specific applications. If you are writing a command-line application\nor CGI script where startup time is essential, you may not be able to use\nMoose (we recommend that you instead use persistent Perl executing environments\nlike `FastCGI` for the latter, if possible).\n\nMouse is a Moose compatible object system, which aims to alleviate this penalty\nby providing a subset of Moose's functionality.\n\nWe're also going as light on dependencies as possible. Mouse currently has\n**no dependencies** except for building/testing modules. Mouse also works\nwithout XS, although it has an XS backend to make it much faster.\n\n## Moose Compatibility\n\nCompatibility with Moose has been the utmost concern. The sugary interface is\nhighly compatible with Moose. Even the error messages are taken from Moose.\nThe Mouse code just runs its test suite 4x faster.\n\nThe idea is that, if you need the extra power, you should be able to run\n`s/Mouse/Moose/g` on your codebase and have nothing break. To that end,\nwe have written [Any::Moose](https://metacpan.org/pod/Any%3A%3AMoose) which will act as Mouse unless Moose is loaded,\nin which case it will act as Moose. Since Mouse is a little sloppier than\nMoose, if you run into weird errors, it would be worth running:\n\n    ANY_MOOSE=Moose perl your-script.pl\n\nto see if the bug is caused by Mouse. Moose's diagnostics and validation are\nalso better.\n\nSee also [Mouse::Spec](https://metacpan.org/pod/Mouse%3A%3ASpec) for compatibility and incompatibility with Moose.\n\n## Mouse Extentions\n\nPlease don't copy MooseX code to MouseX. If you need extensions, you really\nshould upgrade to Moose. We don't need two parallel sets of extensions!\n\nIf you really must write a Mouse extension, please contact the Moose mailing\nlist or #moose on IRC beforehand.\n\n# KEYWORDS\n\n## `$object-\u003emeta -\u003e Mouse::Meta::Class`\n\nReturns this class' metaclass instance.\n\n## `extends superclasses`\n\nSets this class' superclasses.\n\n## `before (method|methods|regexp) =\u003e CodeRef`\n\nInstalls a \"before\" method modifier. See [\"before\" in Moose](https://metacpan.org/pod/Moose#before).\n\n## `after (method|methods|regexp) =\u003e CodeRef`\n\nInstalls an \"after\" method modifier. See [\"after\" in Moose](https://metacpan.org/pod/Moose#after).\n\n## `around (method|methods|regexp) =\u003e CodeRef`\n\nInstalls an \"around\" method modifier. See [\"around\" in Moose](https://metacpan.org/pod/Moose#around).\n\n## `has (name|names) =\u003e parameters`\n\nAdds an attribute (or if passed an arrayref of names, multiple attributes) to\nthis class. Options:\n\n- `is =\u003e ro|rw|bare`\n\n    The _is_ option accepts either _rw_ (for read/write), _ro_ (for read\n    only) or _bare_ (for nothing). These will create either a read/write accessor\n    or a read-only accessor respectively, using the same name as the `$name` of\n    the attribute.\n\n    If you need more control over how your accessors are named, you can\n    use the `reader`, `writer` and `accessor` options, however if you\n    use those, you won't need the _is_ option.\n\n- `isa =\u003e TypeName | ClassName`\n\n    Provides type checking in the constructor and accessor. The following types are\n    supported. Any unknown type is taken to be a class check\n    (e.g. `isa =\u003e 'DateTime'` would accept only [DateTime](https://metacpan.org/pod/DateTime) objects).\n\n        Any Item Bool Undef Defined Value Num Int Str ClassName\n        Ref ScalarRef ArrayRef HashRef CodeRef RegexpRef GlobRef\n        FileHandle Object\n\n    For more documentation on type constraints, see [Mouse::Util::TypeConstraints](https://metacpan.org/pod/Mouse%3A%3AUtil%3A%3ATypeConstraints).\n\n- `does =\u003e RoleName`\n\n    This will accept the name of a role which the value stored in this attribute\n    is expected to have consumed.\n\n- `coerce =\u003e Bool`\n\n    This will attempt to use coercion with the supplied type constraint to change\n    the value passed into any accessors or constructors. You **must** have supplied\n    a type constraint in order for this to work. See [Moose::Cookbook::Basics::Recipe5](https://metacpan.org/pod/Moose%3A%3ACookbook%3A%3ABasics%3A%3ARecipe5)\n    for an example.\n\n- `required =\u003e Bool`\n\n    Whether this attribute is required to have a value. If the attribute is lazy or\n    has a builder, then providing a value for the attribute in the constructor is\n    optional.\n\n- `init_arg =\u003e Str | Undef`\n\n    Allows you to use a different key name in the constructor.  If undef, the\n    attribute can't be passed to the constructor.\n\n- `default =\u003e Value | CodeRef`\n\n    Sets the default value of the attribute. If the default is a coderef, it will\n    be invoked to get the default value. Due to quirks of Perl, any bare reference\n    is forbidden, you must wrap the reference in a coderef. Otherwise, all\n    instances will share the same reference.\n\n- `lazy =\u003e Bool`\n\n    If specified, the default is calculated on demand instead of in the\n    constructor.\n\n- `predicate =\u003e Str`\n\n    Lets you specify a method name for installing a predicate method, which checks\n    that the attribute has a value. It will not invoke a lazy default or builder\n    method.\n\n- `clearer =\u003e Str`\n\n    Lets you specify a method name for installing a clearer method, which clears\n    the attribute's value from the instance. On the next read, lazy or builder will\n    be invoked.\n\n- `handles =\u003e HashRef|ArrayRef|Regexp`\n\n    Lets you specify methods to delegate to the attribute. ArrayRef forwards the\n    given method names to method calls on the attribute. HashRef maps local method\n    names to remote method names called on the attribute. Other forms of\n    [\"handles\"](#handles), such as RoleName and CodeRef, are not yet supported.\n\n- `weak_ref =\u003e Bool`\n\n    Lets you automatically weaken any reference stored in the attribute.\n\n    Use of this feature requires [Scalar::Util](https://metacpan.org/pod/Scalar%3A%3AUtil)!\n\n- `trigger =\u003e CodeRef`\n\n    Any time the attribute's value is set (either through the accessor or the constructor), the trigger is called on it. The trigger receives as arguments the instance, and the new value.\n\n- `builder =\u003e Str`\n\n    Defines a method name to be called to provide the default value of the\n    attribute. `builder =\u003e 'build_foo'` is mostly equivalent to\n    `default =\u003e sub { $_[0]-\u003ebuild_foo }`.\n\n- `auto_deref =\u003e Bool`\n\n    Allows you to automatically dereference ArrayRef and HashRef attributes in list\n    context. In scalar context, the reference is returned (NOT the list length or\n    bucket status). You must specify an appropriate type constraint to use\n    auto\\_deref.\n\n- `lazy_build =\u003e Bool`\n\n    Automatically define the following options:\n\n        has $attr =\u003e (\n            # ...\n            lazy      =\u003e 1\n            builder   =\u003e \"_build_$attr\",\n            clearer   =\u003e \"clear_$attr\",\n            predicate =\u003e \"has_$attr\",\n        );\n\n## `confess(message) -\u003e BOOM`\n\n[\"confess\" in Carp](https://metacpan.org/pod/Carp#confess) for your convenience.\n\n## `blessed(value) -\u003e ClassName | undef`\n\n[\"blessed\" in Scalar::Util](https://metacpan.org/pod/Scalar%3A%3AUtil#blessed) for your convenience.\n\n# MISC\n\n## import\n\nImporting Mouse will default your class' superclass list to [Mouse::Object](https://metacpan.org/pod/Mouse%3A%3AObject).\nYou may use [\"extends\"](#extends) to replace the superclass list.\n\n## unimport\n\nPlease unimport Mouse (`no Mouse`) so that if someone calls one of the\nkeywords (such as [\"extends\"](#extends)) it will break loudly instead breaking subtly.\n\n# DEVELOPMENT\n\nHere is the repo: [https://github.com/gfx/p5-Mouse](https://github.com/gfx/p5-Mouse).\n\nYou can build, test, and release it with **Minilla**.\n\n    cpanm Minilla\n    minil build\n    minil test\n    minil release\n\nNote that `Build.PL` and `README.md` are generated by Minilla,\nso you should not edit them. Edit `minil.toml` and `lib/Mouse.pm` instead.\n\n# SEE ALSO\n\n[Mouse::Role](https://metacpan.org/pod/Mouse%3A%3ARole)\n\n[Mouse::Spec](https://metacpan.org/pod/Mouse%3A%3ASpec)\n\n[Moose](https://metacpan.org/pod/Moose)\n\n[Moose::Manual](https://metacpan.org/pod/Moose%3A%3AManual)\n\n[Moose::Cookbook](https://metacpan.org/pod/Moose%3A%3ACookbook)\n\n[Class::MOP](https://metacpan.org/pod/Class%3A%3AMOP)\n\n[Moo](https://metacpan.org/pod/Moo)\n\n# AUTHORS\n\nShawn M Moore \u0026lt;sartak at gmail.com\u003e\n\nYuval Kogman \u0026lt;nothingmuch at woobling.org\u003e\n\ntokuhirom\n\nYappo\n\nwu-lee\n\nGoro Fuji (gfx) \u003cgfuji@cpan.org\u003e\n\nwith plenty of code borrowed from [Class::MOP](https://metacpan.org/pod/Class%3A%3AMOP) and [Moose](https://metacpan.org/pod/Moose)\n\n# BUGS\n\nAll complex software has bugs lurking in it, and this module is no exception.\nPlease report any bugs to [https://github.com/gfx/p5-Mouse/issues](https://github.com/gfx/p5-Mouse/issues).\n\n# COPYRIGHT AND LICENSE\n\nCopyright (c) 2008-2010 Infinity Interactive, Inc.\n\nhttp://www.iinteractive.com/\n\nThis program is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxslate%2Fp5-Mouse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxslate%2Fp5-Mouse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxslate%2Fp5-Mouse/lists"}