The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sub::Multi::Tiny::Dispatcher::TypeParams - Dispatcher-maker using Type::Params for Sub::Multi::Tiny

SYNOPSIS

    # In a multisub
    require Sub::Multi::Tiny qw($param D:TypeParams);

    # Internals of Sub::Multi::Tiny
    use Type::Params;
    my $dispatcher_coderef =
        Sub::Multi::Tiny::Dispatcher::TypeParams::MakeDispatcher({impls=>[]...});

This module dispatches to any function that can be distinguished by the multisig function in Type::Params. See "MULTIPLE SIGNATURES" in Type::Params.

See Sub::Multi::Tiny for more about the usage of this module. This module does not export any symbols.

USAGE NOTES

Candidate order

The candidates must be listed with more specific first, since they are tried top to bottom. For example, constraint "Str" in Types::Standard matches any scalar (as of Types::Standard v1.004004), so it should be listed after more specific constraints such as "Int" in Types::Standard.

Named parameters

Type::Parameters::multisig() does not directly support named parameters. Instead, use a slurpy hash (Dict) parameter to collect named parameters. An example is given in "Mixed Positional and Named Parameters" in Type::Params.

FUNCTIONS

MakeDispatcher

Make the default dispatcher for the given multi. See "SYNOPSIS".

import

When used, also imports Type::Tiny into the caller's namespace (since Type::Tiny types are how this dispatcher functions!). The caller may also wish to import Types::Standard, but we don't do so here in the interest of generality.

AUTHOR

Chris White <cxw@cpan.org>

LICENSE

Copyright (C) 2019 Chris White <cxw@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.