1Type::Tiny::Duck(3)   User Contributed Perl Documentation  Type::Tiny::Duck(3)
2
3
4

NAME

6       Type::Tiny::Duck - type constraints based on the "can" method
7

STATUS

9       This module is covered by the Type-Tiny stability policy.
10

DESCRIPTION

12       Type constraints of the general form "{ $_->can("method") }".
13
14       This package inherits from Type::Tiny; see that for most documentation.
15       Major differences are listed below:
16
17   Attributes
18       "methods"
19           An arrayref of method names.
20
21       "constraint"
22           Unlike Type::Tiny, you cannot pass a constraint coderef to the
23           constructor.  Instead rely on the default.
24
25       "inlined"
26           Unlike Type::Tiny, you cannot pass an inlining coderef to the
27           constructor.  Instead rely on the default.
28
29       "parent"
30           Parent is always Types::Standard::Object, and cannot be passed to
31           the constructor.
32
33   Methods
34       "stringifies_to($constraint)"
35           See Type::Tiny::ConstrainedObject.
36
37       "numifies_to($constraint)"
38           See Type::Tiny::ConstrainedObject.
39
40       "with_attribute_values($attr1 => $constraint1, ...)"
41           See Type::Tiny::ConstrainedObject.
42
43   Exports
44       Type::Tiny::Duck can be used as an exporter.
45
46         use Type::Tiny::Duck HttpClient => [ 'get', 'post' ];
47
48       This will export the following functions into your namespace:
49
50       "HttpClient"
51       "is_HttpClient( $value )"
52       "assert_HttpClient( $value )"
53       "to_HttpClient( $value )"
54
55       Multiple types can be exported at once:
56
57         use Type::Tiny::Duck (
58           HttpClient   => [ 'get', 'post' ],
59           FtpClient    => [ 'upload', 'download' ],
60         );
61

BUGS

63       Please report any bugs to
64       <https://github.com/tobyink/p5-type-tiny/issues>.
65

SEE ALSO

67       Type::Tiny::Manual.
68
69       Type::Tiny.
70
71       Moose::Meta::TypeConstraint::DuckType.
72

AUTHOR

74       Toby Inkster <tobyink@cpan.org>.
75
77       This software is copyright (c) 2013-2014, 2017-2023 by Toby Inkster.
78
79       This is free software; you can redistribute it and/or modify it under
80       the same terms as the Perl 5 programming language system itself.
81

DISCLAIMER OF WARRANTIES

83       THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
84       WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
85       MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
86
87
88
89perl v5.36.0                      2023-01-04               Type::Tiny::Duck(3)
Impressum