{
    "content": [
        {
            "type": "text",
            "text": "# Type::Params (perldoc)\n\n## NAME\n\nType::Params - Params::Validate-like parameter validation using Type::Tiny type constraints and coercions\n\n## SYNOPSIS\n\nuse v5.12;\nuse strict;\nuse warnings;\npackage Horse {\nuse Moo;\nuse Types::Standard qw( Object );\nuse Type::Params qw( compile );\nuse namespace::autoclean;\n...;   # define attributes, etc\nsub addchild {\nstate $check = compile( Object, Object );  # method signature\nmy ($self, $child) = $check->(@);         # unpack @\npush @{ $self->children }, $child;\nreturn $self;\n}\n}\npackage main;\nmy $boldruler = Horse->new;\n$boldruler->addchild( Horse->new );\n$boldruler->addchild( 123 );   # dies (123 is not an Object!)\n\n## DESCRIPTION\n\nThis documents the details of the Type::Params package. Type::Tiny::Manual is a better starting\nplace if you're new.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **STATUS**\n- **DESCRIPTION** (1 subsections)\n- **ENVIRONMENT**\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::Params",
        "section": "",
        "mode": "perldoc",
        "summary": "Type::Params - Params::Validate-like parameter validation using Type::Tiny type constraints and coercions",
        "synopsis": "use v5.12;\nuse strict;\nuse warnings;\npackage Horse {\nuse Moo;\nuse Types::Standard qw( Object );\nuse Type::Params qw( compile );\nuse namespace::autoclean;\n...;   # define attributes, etc\nsub addchild {\nstate $check = compile( Object, Object );  # method signature\nmy ($self, $child) = $check->(@);         # unpack @\npush @{ $self->children }, $child;\nreturn $self;\n}\n}\npackage main;\nmy $boldruler = Horse->new;\n$boldruler->addchild( Horse->new );\n$boldruler->addchild( 123 );   # dies (123 is not an Object!)",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 30,
                "subsections": []
            },
            {
                "name": "STATUS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 43,
                "subsections": [
                    {
                        "name": "Functions",
                        "lines": 626
                    }
                ]
            },
            {
                "name": "ENVIRONMENT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENCE",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DISCLAIMER OF WARRANTIES",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Type::Params - Params::Validate-like parameter validation using Type::Tiny type constraints and\ncoercions\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use v5.12;\nuse strict;\nuse warnings;\n\npackage Horse {\nuse Moo;\nuse Types::Standard qw( Object );\nuse Type::Params qw( compile );\nuse namespace::autoclean;\n\n...;   # define attributes, etc\n\nsub addchild {\nstate $check = compile( Object, Object );  # method signature\n\nmy ($self, $child) = $check->(@);         # unpack @\npush @{ $self->children }, $child;\n\nreturn $self;\n}\n}\n\npackage main;\n\nmy $boldruler = Horse->new;\n\n$boldruler->addchild( Horse->new );\n\n$boldruler->addchild( 123 );   # dies (123 is not an Object!)\n",
                "subsections": []
            },
            "STATUS": {
                "content": "This module is covered by the Type-Tiny stability policy.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This documents the details of the Type::Params package. Type::Tiny::Manual is a better starting\nplace if you're new.\n\nType::Params uses Type::Tiny constraints to validate the parameters to a sub. It takes the\nslightly unorthodox approach of separating validation into two stages:\n\n1.  Compiling the parameter specification into a coderef; then\n\n2.  Using the coderef to validate parameters.\n\nThe first stage is slow (it might take a couple of milliseconds), but you only need to do it the\nfirst time the sub is called. The second stage is fast; according to my benchmarks faster even\nthan the XS version of Params::Validate.\n\nIf you're using a modern version of Perl, you can use the \"state\" keyword which was a feature\nadded to Perl in 5.10. If you're stuck on Perl 5.8, the example from the SYNOPSIS could be\nrewritten as:\n\nmy $addchildcheck;\nsub addchild {\n$addchildcheck ||= compile( Object, Object );\n\nmy ($self, $child) = $addchildcheck->(@);  # unpack @\npush @{ $self->children }, $child;\n\nreturn $self;\n}\n\nNot quite as neat, but not awful either.\n\nIf you don't like the two step, there's a shortcut reducing it to one step:\n\nuse Type::Params qw( validate );\n\nsub addchild {\nmy ($self, $child) = validate(\\@, Object, Object);\npush @{ $self->children }, $child;\nreturn $self;\n}\n\nType::Params has a few tricks up its sleeve to make sure performance doesn't suffer too much\nwith the shortcut, but it's never going to be as fast as the two stage compile/execute.\n",
                "subsections": [
                    {
                        "name": "Functions",
                        "content": "\"compile(@spec)\"\nGiven specifications for positional parameters, compiles a coderef that can check against them.\n\nThe generalized form of specifications for positional parameters is:\n\nstate $check = compile(\n\\%generalopts,\n$typeforarg1, \\%optsforarg1,\n$typeforarg2, \\%optsforarg2,\n$typeforarg3, \\%optsforarg3,\n...,\nslurpy($slurpytype),\n);\n\nIf a hashref of options is empty, it can simply be omitted. Much of the time, you won't need to\nspecify any options.\n\n# In this example, we omit all the hashrefs\n#\nmy $check = compile(\nStr,\nInt,\nOptional[ArrayRef],\n);\n\nmy ($str, $int, $arr) = $check->(\"Hello\", 42, []);   # ok\nmy ($str, $int, $arr) = $check->(\"\", -1);            # ok\nmy ($str, $int, $arr) = $check->(\"\", -1, \"bleh\");    # dies\n\nThe coderef returned (i.e. $check) will check the arguments passed to it conform to the spec\n(coercing them if appropriate), and return them as a list if they do. If they don't, it will\nthrow an exception.\n\nThe first hashref, before any type constraints, is for general options which affect the entire\ncompiled coderef. Currently supported general options are:\n\n\"head\" Int|ArrayRef[TypeTiny]\nParameters to shift off @ before doing the main type check. These parameters may also be\nchecked, and cannot be optional or slurpy. They may not have defaults.\n\nmy $check = compile(\n{ head => [ Int, Int ] },\nStr,\nStr,\n);\n\n# ... is basically the same as...\n\nmy $check = compile(\nInt,\nInt,\nStr,\nStr,\n);\n\nA number may be given if you do not care to check types:\n\nmy $check = compile(\n{ head => 2 },\nStr,\nStr,\n);\n\n# ... is basically the same as...\n\nmy $check = compile(\nAny,\nAny,\nStr,\nStr,\n);\n\nThis is mostly useless for \"compile\", but can be useful for \"compilenamed\" and\n\"compilenamedoo\".\n\n\"tail\" Int|ArrayRef[TypeTiny]\nSimilar to \"head\", but pops parameters off the end of @ instead. This is actually useful\nfor \"compile\" because it allows you to sneak in some required parameters *after* a slurpy or\noptional parameter.\n\nmy $check = compile(\n{ tail => [ CodeRef ] },\nslurpy ArrayRef[Str],\n);\n\nmy ($strings, $coderef) = $check->(\"foo\", \"bar\", sub { ... });\n\n\"wantsource\" Bool\nInstead of returning a coderef, return Perl source code string. Handy for debugging.\n\n\"wantdetails\" Bool\nInstead of returning a coderef, return a hashref of stuff including the coderef. This is\nmostly for people extending Type::Params and I won't go into too many details about what\nelse this hashref contains.\n\n\"description\" Str\nDescription of the coderef that will show up in stack traces. Defaults to \"parameter\nvalidation for X\" where X is the caller sub name.\n\n\"subname\" Str\nIf you wish to use the default description, but need to change the sub name, use this.\n\n\"callerlevel\" Int\nIf you wish to use the default description, but need to change the caller level for\ndetecting the sub name, use this.\n\nThe types for each parameter may be any Type::Tiny type constraint, or anything that Type::Tiny\nknows how to coerce into a Type::Tiny type constraint, such as a MooseX::Types type constraint\nor a coderef.\n\nType coercions are automatically applied for all types that have coercions.\n\nIf you wish to avoid coercions for a type, use Type::Tiny's \"nocoercions\" method.\n\nmy $check = compile(\nInt,\nArrayRef->of(Bool)->nocoercions,\n);\n\nNote that having any coercions in a specification, even if they're not used in a particular\ncheck, will slightly slow down $check because it means that $check can't just check @ and\nreturn it unaltered if it's valid — it needs to build a new array to return.\n\nOptional parameters can be given using the Optional[] type constraint. In the example above, the\nthird parameter is optional. If it's present, it's required to be an arrayref, but if it's\nabsent, it is ignored.\n\nOptional parameters need to be *after* required parameters in the spec.\n\nAn alternative way to specify optional parameters is using a parameter options hashref.\n\nmy $check = compile(\nStr,\nInt,\nArrayRef, { optional => 1 },\n);\n\nThe following parameter options are supported:\n\n\"optional\" Bool\nThis is an alternative way of indicating that a parameter is optional.\n\nstate $check = compile(\nInt,\nInt, { optional => 1 },\nOptional[Int],\n);\n\nThe two are not *exactly* equivalent. The exceptions thrown will differ in the type name\nthey mention. (Int versus Optional[Int].)\n\n\"default\" CodeRef|Ref|Str|Undef\nA default may be provided for a parameter.\n\nstate $check = compile(\nInt,\nInt, { default => \"666\" },\nInt, { default => \"999\" },\n);\n\nSupported defaults are any strings (including numerical ones), \"undef\", and empty hashrefs\nand arrayrefs. Non-empty hashrefs and arrayrefs are *not allowed as defaults*.\n\nAlternatively, you may provide a coderef to generate a default value:\n\nstate $check = compile(\nInt,\nInt, { default => sub { 6 * 111 } },\nInt, { default => sub { 9 * 111 } },\n);\n\nThat coderef may generate any value, including non-empty arrayrefs and non-empty hashrefs.\nFor undef, simple strings, numbers, and empty structures, avoiding using a coderef will make\nyour parameter processing faster.\n\nThe default *will* be validated against the type constraint, and potentially coerced.\n\nNote that having any defaults in a specification, even if they're not used in a particular\ncheck, will slightly slow down $check because it means that $check can't just check @ and\nreturn it unaltered if it's valid — it needs to build a new array to return.\n\nAs a special case, the numbers 0 and 1 may be used as shortcuts for Optional[Any] and Any.\n\n# Positional parameters\nstate $check = compile(1, 0, 0);\nmy ($foo, $bar, $baz) = $check->(@);  # $bar and $baz are optional\n\nAfter any required and optional parameters may be a slurpy parameter. Any additional arguments\npassed to $check will be slurped into an arrayref or hashref and checked against the slurpy\nparameter. Defaults are not supported for slurpy parameters.\n\nExample with a slurpy ArrayRef:\n\nsub xyz {\nstate $check = compile(Int, Int, slurpy ArrayRef[Int]);\nmy ($foo, $bar, $baz) = $check->(@);\n}\n\nxyz(1..5);  # $foo = 1\n# $bar = 2\n# $baz = [ 3, 4, 5 ]\n\nExample with a slurpy HashRef:\n\nmy $check = compile(\nInt,\nOptional[Str],\nslurpy HashRef[Int],\n);\n\nmy ($x, $y, $z) = $check->(1, \"y\", foo => 666, bar => 999);\n# $x is 1\n# $y is \"y\"\n# $z is { foo => 666, bar => 999 }\n\nAny type constraints derived from ArrayRef or HashRef should work, but a type does need to\ninherit from one of those because otherwise Type::Params cannot know what kind of structure to\nslurp the remaining arguments into.\n\nslurpy Any is also allowed as a special case, and is treated as slurpy ArrayRef.\n\nFrom Type::Params 1.005000 onwards, slurpy hashrefs can be passed in as a true hashref (which\nwill be shallow cloned) rather than key-value pairs.\n\nsub xyz {\nstate $check = compile(Int, slurpy HashRef);\nmy ($num, $hr) = $check->(@);\n...\n}\n\nxyz( 5,   foo => 1, bar => 2   );   # works\nxyz( 5, { foo => 1, bar => 2 } );   # works from 1.005000\n\nThis feature is only implemented for slurpy hashrefs, not slurpy arrayrefs.\n\nNote that having a slurpy parameter will slightly slow down $check because it means that $check\ncan't just check @ and return it unaltered if it's valid — it needs to build a new array to\nreturn.\n\n\"validate(\\@, @spec)\"\nThis example of \"compile\":\n\nsub foo {\nstate $check = compile(@spec);\nmy @args = $check->(@);\n...;\n}\n\nCan be written using \"validate\" as:\n\nsub foo {\nmy @args = validate(\\@, @spec);\n...;\n}\n\nPerformance using \"compile\" will *always* beat \"validate\" though.\n\n\"compilenamed(@spec)\"\n\"compilenamed\" is a variant of \"compile\" for named parameters instead of positional parameters.\n\nThe format of the specification is changed to include names for each parameter:\n\nstate $check = compilenamed(\n\\%generalopts,\nfoo   => $typeforfoo, \\%optsforfoo,\nbar   => $typeforbar, \\%optsforbar,\nbaz   => $typeforbaz, \\%optsforbaz,\n...,\nextra => slurpy($slurpytype),\n);\n\nThe $check coderef will return a hashref.\n\nmy $check = compilenamed(\nfoo => Int,\nbar => Str, { default => \"hello\" },\n);\n\nmy $args = $check->(foo => 42);\n# $args->{foo} is 42\n# $args->{bar} is \"hello\"\n\nThe %generalopts hash supports the same options as \"compile\" plus a few additional options:\n\n\"class\" ClassName\nThe check coderef will, instead of returning a simple hashref, call \"$class->new($hashref)\"\nand return the result.\n\n\"constructor\" Str\nSpecifies an alternative method name instead of \"new\" for the \"class\" option described\nabove.\n\n\"class\" Tuple[ClassName, Str]\nShortcut for declaring both the \"class\" and \"constructor\" options at once.\n\n\"bless\" ClassName\nLike \"class\", but bypass the constructor and directly bless the hashref.\n\n\"namedtolist\" Bool\nInstead of returning a hashref, return a hash slice.\n\nmyfunc(bar => \"x\", foo => \"y\");\n\nsub myfunc {\nstate $check = compilenamed(\n{ namedtolist => 1 },\nfoo => Str, { optional => 1 },\nbar => Str, { optional => 1 },\n);\nmy ($foo, $bar) = $check->(@);\n...; ## $foo is \"y\" and $bar is \"x\"\n}\n\nThe order of keys for the hash slice is the same as the order of the names passed to\n\"compilenamed\". For missing named parameters, \"undef\" is returned in the list.\n\nBasically in the above example, \"myfunc\" takes named parameters, but receieves positional\nparameters.\n\n\"namedtolist\" ArrayRef[Str]\nAs above, but explicitly specify the keys of the hash slice.\n\nLike \"compile\", the numbers 0 and 1 may be used as shortcuts for Optional[Any] and Any.\n\nstate $check = compilenamed(foo => 1, bar => 0, baz => 0);\nmy $args = $check->(@);  # $args->{bar} and $args->{baz} are optional\n\nSlurpy parameters are slurped into a nested hashref.\n\nmy $check = compile(\nfoo    => Str,\nbar    => Optional[Str],\nextra  => slurpy HashRef[Str],\n);\nmy $args = $check->(foo => \"aaa\", quux => \"bbb\");\n\nprint $args->{foo}, \"\\n\";             # aaa\nprint $args->{extra}{quux}, \"\\n\";     # bbb\n\nslurpy Any is treated as slurpy HashRef.\n\nThe \"head\" and \"tail\" options are supported. This allows for a mixture of positional and named\narguments, as long as the positional arguments are non-optional and at the head and tail of @.\n\nmy $check = compile(\n{ head => [ Int, Int ], tail => [ CodeRef ] },\nfoo => Str,\nbar => Str,\nbaz => Str,\n);\n\nmy ($int1, $int2, $args, $coderef)\n= $check->( 666, 999, foo=>'x', bar=>'y', baz=>'z', sub {...} );\n\nsay $args->{bar};  # 'y'\n\nThis can be combined with \"namedtolist\":\n\nmy $check = compile(\n{ head => [ Int, Int ], tail => [ CodeRef ], namedtolist => 1 },\nfoo => Str,\nbar => Str,\nbaz => Str,\n);\n\nmy ($int1, $int2, $foo, $bar, $baz, $coderef)\n= $check->( 666, 999, foo=>'x', bar=>'y', baz=>'z', sub {...} );\n\nsay $bar;  # 'y'\n\n\"validatenamed(\\@, @spec)\"\nLike \"compile\" has \"validate\", \"compilenamed\" has \"validatenamed\". Just like \"validate\", it's\nthe slower way to do things, so stick with \"compilenamed\".\n\n\"compilenamedoo(@spec)\"\nHere's a quick example function:\n\nsub addcontacttodatabase {\nstate $check = compilenamed(\ndbh     => Object,\nid      => Int,\nname    => Str,\n);\nmy $arg = $check->(@);\n\nmy $sth = $arg->{db}->prepare('INSERT INTO contacts VALUES (?, ?)');\n$sth->execute($arg->{id}, $arg->{name});\n}\n\nLooks simple, right? Did you spot that it will always die with an error message *Can't call\nmethod \"prepare\" on an undefined value*?\n\nThis is because we defined a parameter called 'dbh' but later tried to refer to it as $arg{db}.\nHere, Perl gives us a pretty clear error, but sometimes the failures will be far more subtle.\nWouldn't it be nice if instead we could do this?\n\nsub addcontacttodatabase {\nstate $check = compilenamedoo(\ndbh     => Object,\nid      => Int,\nname    => Str,\n);\nmy $arg = $check->(@);\n\nmy $sth = $arg->dbh->prepare('INSERT INTO contacts VALUES (?, ?)');\n$sth->execute($arg->id, $arg->name);\n}\n\nIf we tried to call \"$arg->db\", it would fail because there was no such method.\n\nWell, that's exactly what \"compilenamedoo\" does.\n\nAs well as giving you nice protection against mistyped parameter names, It also looks kinda\npretty, I think. Hash lookups are a little faster than method calls, of course (though\nType::Params creates the methods using Class::XSAccessor if it's installed, so they're still\npretty fast).\n\nAn optional parameter \"foo\" will also get a nifty \"$arg->hasfoo\" predicate method. Yay!\n\n\"compilenamedoo\" gives you some extra options for parameters.\n\nsub addcontacttodatabase {\nstate $check = compilenamedoo(\ndbh     => Object,\nid      => Int,    { default => '0', getter => 'identifier' },\nname    => Str,    { optional => 1, predicate => 'hasname' },\n);\nmy $arg = $check->(@);\n\nmy $sth = $arg->dbh->prepare('INSERT INTO contacts VALUES (?, ?)');\n$sth->execute($arg->identifier, $arg->name) if $arg->hasname;\n}\n\n\"getter\" Str\nThe \"getter\" option lets you choose the method name for getting the argument value.\n\n\"predicate\" Str\nThe \"predicate\" option lets you choose the method name for checking the existence of an\nargument. By setting an explicit predicate method name, you can force a predicate method to\nbe generated for non-optional arguments.\n\nThe objects returned by \"compilenamedoo\" are blessed into lightweight classes which have been\ngenerated on the fly. Don't expect the names of the classes to be stable or predictable. It's\nprobably a bad idea to be checking \"can\", \"isa\", or \"DOES\" on any of these objects. If you're\ndoing that, you've missed the point of them.\n\nThey don't have any constructor (\"new\" method). The $check coderef effectively *is* the\nconstructor.\n\n\"validatenamedoo(\\@, @spec)\"\nThis function doesn't even exist. :D\n\n\"multisig(@alternatives)\"\nType::Params can export a \"multisig\" function that compiles multiple alternative signatures into\none, and uses the first one that works:\n\nstate $check = multisig(\n[ Int, ArrayRef ],\n[ HashRef, Num ],\n[ CodeRef ],\n);\n\nmy ($int, $arrayref) = $check->( 1, [] );      # okay\nmy ($hashref, $num)  = $check->( {}, 1.1 );    # okay\nmy ($code)           = $check->( sub { 1 } );  # okay\n\n$check->( sub { 1 }, 1.1 );  # throws an exception\n\nCoercions, slurpy parameters, etc still work.\n\nThe magic global \"${^TYPEPARAMSMULTISIG}\" is set to the index of the first signature which\nsucceeded.\n\nThe present implementation involves compiling each signature independently, and trying them each\n(in their given order!) in an \"eval\" block. The only slightly intelligent part is that it checks\nif \"scalar(@)\" fits into the signature properly (taking into account optional and slurpy\nparameters), and skips evals which couldn't possibly succeed.\n\nIt's also possible to list coderefs as alternatives in \"multisig\":\n\nstate $check = multisig(\n[ Int, ArrayRef ],\nsub { ... },\n[ HashRef, Num ],\n[ CodeRef ],\ncompilenamed( needle => Value, haystack => Ref ),\n);\n\nThe coderef is expected to die if that alternative should be abandoned (and the next alternative\ntried), or return the list of accepted parameters. Here's a full example:\n\nsub getfrom {\nstate $check = multisig(\n[ Int, ArrayRef ],\n[ Str, HashRef ],\nsub {\nmy ($meth, $obj);\ndie unless isObject($obj);\ndie unless $obj->can($meth);\nreturn ($meth, $obj);\n},\n);\n\nmy ($needle, $haystack) = $check->(@);\n\nfor (${^TYPEPARAMSMULTISIG}) {\nreturn $haystack->[$needle] if $ == 0;\nreturn $haystack->{$needle} if $ == 1;\nreturn $haystack->$needle   if $ == 2;\n}\n}\n\ngetfrom(0, \\@array);      # returns $array[0]\ngetfrom('foo', \\%hash);   # returns $hash{foo}\ngetfrom('foo', $obj);     # returns $obj->foo\n\nThe default error message is just \"Parameter validation failed\". You can pass an option hashref\nas the first argument with an informative message string:\n\nsub foo {\nstate $OptionsDict = Dict[...];\nstate $check = multisig(\n{ message => 'USAGE: $object->foo(\\%options?, $string)' },\n[ Object, $OptionsDict, StringLike ],\n[ Object, StringLike ],\n);\nmy ($self, @args) = $check->(@);\nmy ($opts, $str)  = ${^TYPEPARAMSMULTISIG} ? ({}, @args) : @;\n...;\n}\n\n$obj->foo(\\%opts, \"Hello\");\n$obj->foo(\"World\");\n\n\"wrapsubs( $subname1, $wrapper1, ... )\"\nIt's possible to turn the check inside-out and instead of the sub calling the check, the check\ncan call the original sub.\n\nNormal way:\n\nuse Type::Param qw(compile);\nuse Types::Standard qw(Int Str);\n\nsub foobar {\nstate $check = compile(Int, Str);\nmy ($foo, $bar) = @;\n...;\n}\n\nInside-out way:\n\nuse Type::Param qw(wrapsubs);\nuse Types::Standard qw(Int Str);\n\nsub foobar {\nmy ($foo, $bar) = @;\n...;\n}\n\nwrapsubs foobar => [Int, Str];\n\n\"wrapsubs\" takes a hash of subs to wrap. The keys are the sub names and the values are either\narrayrefs of arguments to pass to \"compile\" to make a check, or coderefs that have already been\nbuilt by \"compile\", \"compilenamed\", or \"compilenamedoo\".\n\n\"wrapmethods( $subname1, $wrapper1, ... )\"\n\"wrapmethods\" also exists, which shifts off the invocant from @ before the check, but unshifts\nit before calling the original sub.\n\nuse Type::Param qw(wrapsubs);\nuse Types::Standard qw(Int Str);\n\nsub foobar {\nmy ($self, $foo, $bar) = @;\n...;\n}\n\nwrapsubs foobar => [Int, Str];\n\nInvocant\nType::Params exports a type Invocant on request. This gives you a type constraint which accepts\nclassnames *and* blessed objects.\n\nuse Type::Params qw( compile Invocant );\n\nsub mymethod {\nstate $check = compile(Invocant, ArrayRef, Int);\nmy ($selforclass, $arr, $ix) = $check->(@);\n\nreturn $arr->[ $ix ];\n}\n\nArgsObject\nType::Params exports a parameterizable type constraint ArgsObject. It accepts the kinds of\nobjects returned by \"compilenamedoo\" checks.\n\npackage Foo {\nuse Moo;\nuse Type::Params 'ArgsObject';\n\nhas args => (\nis  => 'ro',\nisa => ArgsObject['Bar::bar'],\n);\n}\n\npackage Bar {\nuse Types::Standard -types;\nuse Type::Params 'compilenamedoo';\n\nsub bar {\nstate $check = compilenamedoo(\nxxx => Int,\nyyy => ArrayRef,\n);\nmy $args = &$check;\n\nreturn 'Foo'->new( args => $args );\n}\n}\n\nBar::bar( xxx => 42, yyy => [] );\n\nThe parameter \"Bar::bar\" refers to the caller when the check is compiled, rather than when the\nparameters are checked.\n"
                    }
                ]
            },
            "ENVIRONMENT": {
                "content": "\"PERLTYPEPARAMSXS\"\nAffects the building of accessors for \"compilenamedoo\". If set to true, will use\nClass::XSAccessor. If set to false, will use pure Perl. If this environment variable does\nnot exist, will use Class::XSAccessor if it is available.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "Please report any bugs to <https://github.com/tobyink/p5-type-tiny/issues>.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "The Type::Tiny homepage <https://typetiny.toby.ink/>.\n\nType::Tiny, Type::Coercion, Types::Standard.\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": []
            }
        }
    }
}