Params-Signature

 view release on metacpan or  search on metacpan

lib/Params/Signature/Multi.pm  view on Meta::CPAN

Using named, rather than positional, parameters can help eliminate some ambiguity, provided you use a different parameter name for the different types of values.  If, like in the example above, both signatures use the same name (arg_one), using named...

    sub int_or_str
    {
        my ($idx, $id) = $multi->resolve(
                    params => \@_, 
                    signatures => [
                        { id => "is_int",  signature => ["Int int_arg"]},
                        { id => "is_str",  signature => ["Str str_arg"]},
                    ],
                    param_tyle => "named"
                );
        ...
    }

    int_or_str(int_arg => 123);   # resolves to "is_int"
    int_or_str(int_arg => "123"); # also resolves to "is_int"!
    int_or_str(str_arg => "hi");  # resolves to "is_str"
    int_or_str(str_arg => "123"); # also resolves to "is_str"!


=cut

=head1 AUTHOR

Sandor Patocs

=head1 BUGS

Please report any bugs or feature requests on GitHub at
L<https://github.com/spatocs/params_signature/issues>.


=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Params::Signature::Multi


You can also look for information at:

=over 4

=item * GitHub: source repository and issue tracker

L<https://github.com/spatocs/params_signature>

=item * MetaCPAN

L<https://metacpan.org/release/Params-Signature>

=back


=head1 ACKNOWLEDGEMENTS


=head1 SEE ALSO

L<MooseX::Method::Signatures>, L<MooseX::MultiMethods>, L<Method::Signatures>, L<Perl6::Signature>


=head1 LICENSE AND COPYRIGHT

Copyright 2013 Sandor Patocs.

This program is distributed under the terms of the Artisitic License (2.0)


=cut

1; # End of Params::Signature



( run in 1.980 second using v1.01-cache-2.11-cpan-e86d8f7595a )