{
    "content": [
        {
            "type": "text",
            "text": "# Type::Library (perldoc)\n\n## NAME\n\nType::Library - tiny, yet Moo(se)-compatible type libraries\n\n## SYNOPSIS\n\npackage Types::Mine {\nuse Scalar::Util qw(lookslikenumber);\nuse Type::Library -base;\nuse Type::Tiny;\nmy $NUM = \"Type::Tiny\"->new(\nname       => \"Number\",\nconstraint => sub { lookslikenumber($) },\nmessage    => sub { \"$ ain't a number\" },\n);\nPACKAGE->meta->addtype($NUM);\nPACKAGE->meta->makeimmutable;\n}\npackage Ermintrude {\nuse Moo;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}\npackage Bullwinkle {\nuse Moose;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}\npackage Maisy {\nuse Mouse;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}\n\n## DESCRIPTION\n\nType::Library is a tiny class for creating MooseX::Types-like type libraries which are\ncompatible with Moo, Moose and Mouse.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **STATUS**\n- **DESCRIPTION** (3 subsections)\n- **BUGS**\n- **SEE ALSO**\n- **AUTHOR**\n- **COPYRIGHT AND LICENCE**\n- **DISCLAIMER OF WARRANTIES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Type::Library",
        "section": "",
        "mode": "perldoc",
        "summary": "Type::Library - tiny, yet Moo(se)-compatible type libraries",
        "synopsis": "package Types::Mine {\nuse Scalar::Util qw(lookslikenumber);\nuse Type::Library -base;\nuse Type::Tiny;\nmy $NUM = \"Type::Tiny\"->new(\nname       => \"Number\",\nconstraint => sub { lookslikenumber($) },\nmessage    => sub { \"$ ain't a number\" },\n);\nPACKAGE->meta->addtype($NUM);\nPACKAGE->meta->makeimmutable;\n}\npackage Ermintrude {\nuse Moo;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}\npackage Bullwinkle {\nuse Moose;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}\npackage Maisy {\nuse Mouse;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 34,
                "subsections": []
            },
            {
                "name": "STATUS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": [
                    {
                        "name": "Methods",
                        "lines": 58
                    },
                    {
                        "name": "Constants",
                        "lines": 8
                    },
                    {
                        "name": "Export",
                        "lines": 63
                    }
                ]
            },
            {
                "name": "BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENCE",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DISCLAIMER OF WARRANTIES",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Type::Library - tiny, yet Moo(se)-compatible type libraries\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package Types::Mine {\nuse Scalar::Util qw(lookslikenumber);\nuse Type::Library -base;\nuse Type::Tiny;\n\nmy $NUM = \"Type::Tiny\"->new(\nname       => \"Number\",\nconstraint => sub { lookslikenumber($) },\nmessage    => sub { \"$ ain't a number\" },\n);\n\nPACKAGE->meta->addtype($NUM);\n\nPACKAGE->meta->makeimmutable;\n}\n\npackage Ermintrude {\nuse Moo;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}\n\npackage Bullwinkle {\nuse Moose;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}\n\npackage Maisy {\nuse Mouse;\nuse Types::Mine qw(Number);\nhas favouritenumber => (is => \"ro\", isa => Number);\n}\n",
                "subsections": []
            },
            "STATUS": {
                "content": "This module is covered by the Type-Tiny stability policy.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Type::Library is a tiny class for creating MooseX::Types-like type libraries which are\ncompatible with Moo, Moose and Mouse.\n\nIf you're reading this because you want to create a type library, then you're probably better\noff reading Type::Tiny::Manual::Libraries.\n",
                "subsections": [
                    {
                        "name": "Methods",
                        "content": "A type library is a singleton class. Use the \"meta\" method to get a blessed object which other\nmethods can get called on. For example:\n\nTypes::Mine->meta->addtype($foo);\n\n\"addtype($type)\" or \"addtype(%opts)\"\nAdd a type to the library. If %opts is given, then this method calls\n\"Type::Tiny->new(%opts)\" first, and adds the resultant type.\n\nAdding a type named \"Foo\" to the library will automatically define four functions in the\nlibrary's namespace:\n\n\"Foo\"\nReturns the Type::Tiny object.\n\n\"isFoo($value)\"\nReturns true iff $value passes the type constraint.\n\n\"assertFoo($value)\"\nReturns $value iff $value passes the type constraint. Dies otherwise.\n\n\"toFoo($value)\"\nCoerces the value to the type.\n\n\"gettype($name)\"\nGets the \"Type::Tiny\" object corresponding to the name.\n\n\"hastype($name)\"\nBoolean; returns true if the type exists in the library.\n\n\"typenames\"\nList all types defined by the library.\n\n\"addcoercion($c)\" or \"addcoercion(%opts)\"\nAdd a standalone coercion to the library. If %opts is given, then this method calls\n\"Type::Coercion->new(%opts)\" first, and adds the resultant coercion.\n\nAdding a coercion named \"FooFromBar\" to the library will automatically define a function in\nthe library's namespace:\n\n\"FooFromBar\"\nReturns the Type::Coercion object.\n\n\"getcoercion($name)\"\nGets the \"Type::Coercion\" object corresponding to the name.\n\n\"hascoercion($name)\"\nBoolean; returns true if the coercion exists in the library.\n\n\"coercionnames\"\nList all standalone coercions defined by the library.\n\n\"import(@args)\"\nType::Library-based libraries are exporters.\n\n\"makeimmutable\"\nA shortcut for calling \"$type->coercion->freeze\" on every type constraint in the library.\n"
                    },
                    {
                        "name": "Constants",
                        "content": "\"NICEPROTOTYPES\"\nIf this is true, then Type::Library will give parameterizable type constraints slightly the\nnicer prototype of \"(;$)\" instead of the default \"(;@)\". This allows constructs like:\n\nArrayRef[Int] | HashRef[Int]\n\n... to \"just work\".\n"
                    },
                    {
                        "name": "Export",
                        "content": "Type libraries are exporters. For the purposes of the following examples, assume that the\n\"Types::Mine\" library defines types \"Number\" and \"String\".\n\n# Exports nothing.\n#\nuse Types::Mine;\n\n# Exports a function \"String\" which is a constant returning\n# the String type constraint.\n#\nuse Types::Mine qw( String );\n\n# Exports both String and Number as above.\n#\nuse Types::Mine qw( String Number );\n\n# Same.\n#\nuse Types::Mine qw( :types );\n\n# Exports \"coerceString\" and \"coerceNumber\", as well as any other\n# coercions\n#\nuse Types::Mine qw( :coercions );\n\n# Exports a sub \"isString\" so that \"isString($foo)\" is equivalent\n# to \"String->check($foo)\".\n#\nuse Types::Mine qw( isString );\n\n# Exports \"isString\" and \"isNumber\".\n#\nuse Types::Mine qw( :is );\n\n# Exports a sub \"assertString\" so that \"assertString($foo)\" is\n# equivalent to \"String->assertreturn($foo)\".\n#\nuse Types::Mine qw( assertString );\n\n# Exports \"assertString\" and \"assertNumber\".\n#\nuse Types::Mine qw( :assert );\n\n# Exports a sub \"toString\" so that \"toString($foo)\" is equivalent\n# to \"String->coerce($foo)\".\n#\nuse Types::Mine qw( toString );\n\n# Exports \"toString\" and \"toNumber\".\n#\nuse Types::Mine qw( :to );\n\n# Exports \"String\", \"isString\", \"assertString\" and \"coerceString\".\n#\nuse Types::Mine qw( +String );\n\n# Exports everything.\n#\nuse Types::Mine qw( :all );\n\nType libraries automatically inherit from Exporter::Tiny; see the documentation of that module\nfor tips and tricks importing from libraries.\n"
                    }
                ]
            },
            "BUGS": {
                "content": "Please report any bugs to <https://github.com/tobyink/p5-type-tiny/issues>.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Type::Tiny::Manual.\n\nType::Tiny, Type::Utils, Types::Standard, Type::Coercion.\n\nMoose::Util::TypeConstraints, Mouse::Util::TypeConstraints.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Toby Inkster <tobyink@cpan.org>.\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENCE": {
                "content": "This software is copyright (c) 2013-2014, 2017-2021 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": []
            }
        }
    }
}