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

NAME

6       Type::Parser - parse type constraint strings
7

SYNOPSIS

9        use v5.10;
10        use strict;
11        use warnings;
12
13        use Type::Parser qw( eval_type );
14        use Type::Registry;
15
16        my $reg = Type::Registry->for_me;
17        $reg->add_types("Types::Standard");
18
19        my $type = eval_type("Int | ArrayRef[Int]", $reg);
20
21        $type->check(10);        # true
22        $type->check([1..4]);    # true
23        $type->check({foo=>1});  # false
24

STATUS

26       This module is covered by the Type-Tiny stability policy.
27

DESCRIPTION

29       Generally speaking, you probably don't want to be using this module
30       directly.  Instead use the "lookup" method from Type::Registry which
31       wraps it.
32
33   Functions
34       "parse($string)"
35           Parse the type constraint string into something like an AST.
36
37           If called in list context, also returns any "tail" found on the
38           original string.
39
40       "extract_type($string, $registry)"
41           Compile a type constraint string into a Type::Tiny object.
42
43           If called in list context, also returns any "tail" found on the
44           original string.
45
46       "eval_type($string, $registry)"
47           Compile a type constraint string into a Type::Tiny object.
48
49           Throws an error if the "tail" contains any non-whitespace
50           character.
51
52   Constants
53       The following constants correspond to values returned by
54       "$token->type".
55
56       "TYPE"
57       "QUOTELIKE"
58       "STRING"
59       "CLASS"
60       "L_BRACKET"
61       "R_BRACKET"
62       "COMMA"
63       "SLURPY"
64       "UNION"
65       "INTERSECT"
66       "NOT"
67       "L_PAREN"
68       "R_PAREN"
69       "MYSTERY"
70

BUGS

72       Please report any bugs to
73       <http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>.
74

SEE ALSO

76       Type::Registry.
77

AUTHOR

79       Toby Inkster <tobyink@cpan.org>.
80
82       This software is copyright (c) 2013-2014, 2017-2020 by Toby Inkster.
83
84       This is free software; you can redistribute it and/or modify it under
85       the same terms as the Perl 5 programming language system itself.
86

DISCLAIMER OF WARRANTIES

88       THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
89       WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
90       MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
91
92
93
94perl v5.32.0                      2020-09-17                   Type::Parser(3)
Impressum