{
    "mode": "perldoc",
    "parameter": "Exporter::Tiny::Manual::QuickStart",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Exporter%3A%3ATiny%3A%3AManual%3A%3AQuickStart/json",
    "generated": "2026-06-12T12:23:03Z",
    "synopsis": "package MyUtils;\nuse Exporter::Shiny qw( frobnicate );\nsub frobnicate {\n...;   # your code here\n}\n1;\nNow people can use your module like this:\nuse MyUtils \"frobnicate\";\nfrobnicate(42);\nOr like this:\nuse MyUtils \"frobnicate\" => { -as => \"frob\" };\nfrob(42);",
    "sections": {
        "NAME": {
            "content": "Exporter::Tiny::Manual::QuickStart - the quickest way to get up and running with Exporter::Tiny\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "package MyUtils;\n\nuse Exporter::Shiny qw( frobnicate );\n\nsub frobnicate {\n...;   # your code here\n}\n\n1;\n\nNow people can use your module like this:\n\nuse MyUtils \"frobnicate\";\n\nfrobnicate(42);\n\nOr like this:\n\nuse MyUtils \"frobnicate\" => { -as => \"frob\" };\n\nfrob(42);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "See the synopsis. Yes, it's that simple.\n",
            "subsections": [
                {
                    "name": "Next steps",
                    "content": "Default exports\nNote that the module in the synopsis doesn't export anything by default. If people load\n\"MyUtils\" like this:\n\nuse MyUtils;\n\nThen they haven't imported any functions. You can specify a default set of functions to be\nexported like this:\n\npackage MyUtils;\n\nuse Exporter::Shiny qw( frobnicate );\n\nour @EXPORT = qw( frobnicate );\n\nsub frobnicate { ... }\n\n1;\n\nOr, if you want to be a superstar rock god:\n\npackage MyUtils;\n\nuse Exporter::Shiny our @EXPORT = qw( frobnicate );\n\nsub frobnicate { ... }\n\n1;\n\nTags\nYou can provide tags for people to use:\n\npackage MyUtils;\n\nuse Exporter::Shiny qw( frobnicate red green blue );\n\nour %EXPORTTAGS = (\nutils   => [qw/ frobnicate /],\ncolours => [qw/ red green blue /],\n);\n\nsub frobnicate { ... }\nsub red        { ... }\nsub green      { ... }\nsub blue       { ... }\n\n1;\n\nAnd people can now import your functions like this:\n\nuse MyUtils \":colours\";\n\nOr this:\n\nuse MyUtils \"-colours\";\n\nOr take advantage of the fact that Perl magically quotes barewords preceded by a hyphen:\n\nuse MyUtils -colours;\n\nTwo tags are automatically defined for you: \"-default\" (which is just the same as @EXPORT) and\n\"-all\" (which is the union of @EXPORT and @EXPORTOK). If you don't like them, then you can\noverride them:\n\nour %EXPORTTAGS = (\ndefault => \\@someotherstuff,\nall     => \\@morestuff,\n);\n\nGenerators\nExporting normally just works by copying a sub from your package into your caller's package. But\nsometimes it's useful instead to generate a *custom* sub to insert into your caller's package.\nThis is pretty easy to do.\n\npackage MyUtils;\n\nuse Exporter::Shiny qw( frobnicate );\n\nsub generatefrobnicate {\nmy $me     = shift;\nmy $caller = caller;\nmy ($name, $args) = @;\n\nreturn sub {\n...;  # your code here\n};\n}\n\n1;\n\nThe parameter $me here is a string containing the package name which is being imported from;\n$caller is the destination package; $name is the name of the sub (in this case \"frobnicate\");\nand $args is a hashref of custom arguments for this function.\n\n# The hashref { foo => 42 } is $args above.\n#\nuse MyUtils \"frobnicate\" => { foo => 42 };\n"
                },
                {
                    "name": "Avoiding Exporter::Shiny",
                    "content": "Exporter::Shiny is a tiny shim around Exporter::Tiny. It should mostly do what you want, but you\nmay sometimes prefer to use Exporter::Tiny directly.\n\nThe example in the synopsis could have been written as:\n\npackage MyUtils;\n\nuse parent \"Exporter::Tiny\";\nour @EXPORTOK = qw( frobnicate );\n\nsub frobnicate {\n...;   # your code here\n}\n\n1;\n\nWhat Exporter::Shiny does is mostly just to set @EXPORTOK for you and set up inheritance from\nthe base class (Exporter::Tiny).\n\nExporter::Shiny also sets $INC{'MyUtils.pm} for you, which in usually makes little difference,\nbut is useful in some edge cases.\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "Exporter::Shiny, Exporter::Tiny.\n\nFor more advanced information, see Exporter::Tiny::Manual::Exporting.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Toby Inkster <tobyink@cpan.org>.\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENCE": {
            "content": "This software is copyright (c) 2013-2014, 2017 by Toby Inkster.\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": []
        },
        "DISCLAIMER OF WARRANTIES": {
            "content": "THIS PACKAGE IS PROVIDED \"AS IS\" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\nWITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.\n",
            "subsections": []
        }
    },
    "summary": "Exporter::Tiny::Manual::QuickStart - the quickest way to get up and running with Exporter::Tiny",
    "flags": [],
    "examples": [],
    "see_also": []
}