{
    "content": [
        {
            "type": "text",
            "text": "# Moose::Exporter (perldoc)\n\n## NAME\n\nMoose::Exporter - make an import() and unimport() just like Moose.pm\n\n## SYNOPSIS\n\npackage MyApp::Moose;\nuse Moose ();\nuse Moose::Exporter;\nuse Some::Random ();\nMoose::Exporter->setupimportmethods(\nwithmeta => [ 'hasrw', 'sugar2' ],\nasis     => [ 'sugar3', \\&Some::Random::thing, 'Some::Random::otherthing' ],\nalso      => 'Moose',\n);\nsub hasrw {\nmy ( $meta, $name, %options ) = @;\n$meta->addattribute(\n$name,\nis => 'rw',\n%options,\n);\n}\n# then later ...\npackage MyApp::User;\nuse MyApp::Moose;\nhas 'name' => ( is => 'ro' );\nhasrw 'size';\nthing;\notherthing;\nno MyApp::Moose;\n\n## DESCRIPTION\n\nThis module encapsulates the exporting of sugar functions in a \"Moose.pm\"-like manner. It does\nthis by building custom \"import\" and \"unimport\" methods for your module, based on a spec you\nprovide.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS**\n- **METACLASS TRAITS**\n- **BUGS**\n- **AUTHORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Moose::Exporter",
        "section": "",
        "mode": "perldoc",
        "summary": "Moose::Exporter - make an import() and unimport() just like Moose.pm",
        "synopsis": "package MyApp::Moose;\nuse Moose ();\nuse Moose::Exporter;\nuse Some::Random ();\nMoose::Exporter->setupimportmethods(\nwithmeta => [ 'hasrw', 'sugar2' ],\nasis     => [ 'sugar3', \\&Some::Random::thing, 'Some::Random::otherthing' ],\nalso      => 'Moose',\n);\nsub hasrw {\nmy ( $meta, $name, %options ) = @;\n$meta->addattribute(\n$name,\nis => 'rw',\n%options,\n);\n}\n# then later ...\npackage MyApp::User;\nuse MyApp::Moose;\nhas 'name' => ( is => 'ro' );\nhasrw 'size';\nthing;\notherthing;\nno MyApp::Moose;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 104,
                "subsections": []
            },
            {
                "name": "METACLASS TRAITS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Moose::Exporter - make an import() and unimport() just like Moose.pm\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 2.2200\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package MyApp::Moose;\n\nuse Moose ();\nuse Moose::Exporter;\nuse Some::Random ();\n\nMoose::Exporter->setupimportmethods(\nwithmeta => [ 'hasrw', 'sugar2' ],\nasis     => [ 'sugar3', \\&Some::Random::thing, 'Some::Random::otherthing' ],\nalso      => 'Moose',\n);\n\nsub hasrw {\nmy ( $meta, $name, %options ) = @;\n$meta->addattribute(\n$name,\nis => 'rw',\n%options,\n);\n}\n\n# then later ...\npackage MyApp::User;\n\nuse MyApp::Moose;\n\nhas 'name' => ( is => 'ro' );\nhasrw 'size';\nthing;\notherthing;\n\nno MyApp::Moose;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module encapsulates the exporting of sugar functions in a \"Moose.pm\"-like manner. It does\nthis by building custom \"import\" and \"unimport\" methods for your module, based on a spec you\nprovide.\n\nIt also lets you \"stack\" Moose-alike modules so you can export Moose's sugar as well as your\nown, along with sugar from any random \"MooseX\" module, as long as they all use\n\"Moose::Exporter\". This feature exists to let you bundle a set of MooseX modules into a policy\nmodule that developers can use directly instead of using Moose itself.\n\nTo simplify writing exporter modules, \"Moose::Exporter\" also imports \"strict\" and \"warnings\"\ninto your exporter module, as well as into modules that use it.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "This module provides two public methods:\n\nMoose::Exporter->setupimportmethods(...)\nWhen you call this method, \"Moose::Exporter\" builds custom \"import\" and \"unimport\" methods for\nyour module. The \"import\" method will export the functions you specify, and can also re-export\nfunctions exported by some other module (like \"Moose.pm\"). If you pass any parameters for\nMoose::Util::MetaRole, the \"import\" method will also call Moose::Util::MetaRole::applymetaroles\nand Moose::Util::MetaRole::applybaseclassroles as needed, after making sure the metaclass is\ninitialized.\n\nThe \"unimport\" method cleans the caller's namespace of all the exported functions. This includes\nany functions you re-export from other packages. However, if the consumer of your package also\nimports those functions from the original package, they will *not* be cleaned.\n\nNote that if any of these methods already exist, they will not be overridden, you will have to\nuse \"buildimportmethods\" to get the coderef that would be installed.\n\nThis method accepts the following parameters:\n\n*   withmeta => [ ... ]\n\nThis list of function *names only* will be wrapped and then exported. The wrapper will pass\nthe metaclass object for the caller as its first argument.\n\nMany sugar functions will need to use this metaclass object to do something to the calling\npackage.\n\n*   asis => [ ... ]\n\nThis list of function names or sub references will be exported as-is. You can identify a\nsubroutine by reference, which is handy to re-export some other module's functions directly\nby reference (\"\\&Some::Package::function\").\n\nIf you do export some other package's function, this function will never be removed by the\n\"unimport\" method. The reason for this is we cannot know if the caller *also* explicitly\nimported the sub themselves, and therefore wants to keep it.\n\n*   traitaliases => [ ... ]\n\nThis is a list of package names which should have shortened aliases exported, similar to the\nfunctionality of aliased. Each element in the list can be either a package name, in which\ncase the export will be named as the last namespace component of the package, or an\narrayref, whose first element is the package to alias to, and second element is the alias to\nexport.\n\n*   also => $name or \\@names\n\nThis is a list of modules which contain functions that the caller wants to export. These\nmodules must also use \"Moose::Exporter\". The most common use case will be to export the\nfunctions from \"Moose.pm\". Functions specified by \"withmeta\" or \"asis\" take precedence\nover functions exported by modules specified by \"also\", so that a module can selectively\noverride functions exported by another module.\n\n\"Moose::Exporter\" also makes sure all these functions get removed when \"unimport\" is called.\n\n*   metalookup => sub { ... }\n\nThis is a function which will be called to provide the metaclass to be operated upon by the\nexporter. This is an advanced feature intended for use by package generator modules in the\nvein of MooseX::Role::Parameterized in order to simplify reusing sugar from other modules\nthat use \"Moose::Exporter\". This function is used, for example, to select the metaclass to\nbind to functions that are exported using the \"withmeta\" option.\n\nThis function will receive one parameter: the class name into which the sugar is being\nexported. The default implementation is:\n\nsub { Class::MOP::classof(shift) }\n\nAccordingly, this function is expected to return a metaclass.\n\nYou can also provide parameters for Moose::Util::MetaRole::applymetaroles and\nMoose::Util::MetaRole::applybaseclassroles. Specifically, valid parameters are\n\"classmetaroles\", \"rolemetaroles\", and \"baseclassroles\".\n\nMoose::Exporter->buildimportmethods(...)\nReturns three code refs, one for \"import\", one for \"unimport\" and one for \"initmeta\".\n\nAccepts the additional \"install\" option, which accepts an arrayref of method names to install\ninto your exporting package. The valid options are \"import\" and \"unimport\". Calling\n\"setupimportmethods\" is equivalent to calling \"buildimportmethods\" with \"install =>\n[qw(import unimport)]\" except that it doesn't also return the methods.\n\nThe \"import\" method is built using Sub::Exporter. This means that it can take a hashref of the\nform \"{ into => $package }\" to specify the package it operates on.\n\nUsed by \"setupimportmethods\".\n\nIMPORTING AND initmeta\nIf you want to set an alternative base object class or metaclass class, see above for details on\nhow this module can call Moose::Util::MetaRole for you.\n\nIf you want to do something that is not supported by this module, simply define an \"initmeta\"\nmethod in your class. The \"import\" method that \"Moose::Exporter\" generates for you will call\nthis method (if it exists). It will always pass the caller to this method via the \"forclass\"\nparameter.\n\nMost of the time, your \"initmeta\" method will probably just call \"Moose->initmeta\" to do the\nreal work:\n\nsub initmeta {\nshift; # our class name\nreturn Moose->initmeta( @, metaclass => 'My::Metaclass' );\n}\n",
                "subsections": []
            },
            "METACLASS TRAITS": {
                "content": "The \"import\" method generated by \"Moose::Exporter\" will allow the user of your module to specify\nmetaclass traits in a \"-traits\" parameter passed as part of the import:\n\nuse Moose -traits => 'My::Meta::Trait';\n\nuse Moose -traits => [ 'My::Meta::Trait', 'My::Other::Trait' ];\n\nThese traits will be applied to the caller's metaclass instance. Providing traits for an\nexporting class that does not create a metaclass for the caller is an error.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "See \"BUGS\" in Moose for details on reporting bugs.\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": []
            }
        }
    }
}