1MooseX::Types::Perl(3)User Contributed Perl DocumentationMooseX::Types::Perl(3)
2
3
4
6 MooseX::Types::Perl - Moose types that check against Perl syntax
7
9 version 0.101344
10
12 use MooseX::Types::Perl qw(
13 DistName
14
15 ModuleName
16 PackageName
17
18 Identifier
19 SafeIdentifier
20
21 LaxVersionStr
22 StrictVersionStr
23 VersionObject
24 );
25
27 This library provides Moose types for checking things (mostly strings)
28 against syntax that is, or is a reasonable subset of, Perl syntax.
29
31 This library should run on perls released even a long time ago. It
32 should work on any version of perl released in the last five years.
33
34 Although it may work on older versions of perl, no guarantee is made
35 that the minimum required version will not be increased. The version
36 may be increased for any reason, and there is no promise that patches
37 will be accepted to lower the minimum required perl.
38
40 ModuleName
41 PackageName
42 These types are identical, and expect a string that could be a package
43 or module name. That's basically a bunch of identifiers stuck together
44 with double-colons. One key quirk is that parts of the package name
45 after the first may begin with digits.
46
47 The use of an apostrophe as a package separator is not permitted.
48
49 DistName
50 The DistName type checks for a string like "MooseX-Types-Perl", the
51 sort of thing used to name CPAN distributions. In general, it's like
52 the more familiar ModuleName, but with hyphens instead of double-
53 colons.
54
55 In reality, a few distribution names may not match this pattern -- most
56 famously, "CGI.pm" is the name of the distribution that contains CGI.
57 These exceptions are few and far between, and deciding what a
58 "LaxDistName" type would look like has not seemed worth it, yet.
59
60 Identifier
61 An Identifier is something that could be used as a symbol name or other
62 identifier (filehandle, directory handle, subroutine name, format name,
63 or label). It's what you put after the sigil (dollar sign, at sign,
64 percent sign) in a variable name. Generally, it's a bunch of
65 alphanumeric characters not starting with a digit.
66
67 Although Perl identifiers may contain non-ASCII characters in some
68 circumstances, this type does not allow it. A "UnicodeIdentifier" type
69 may be added in the future.
70
71 SafeIdentifier
72 SafeIdentifiers are just like Identifiers, but omit the single-letter
73 variables underscore, a, and b, as these have special significance.
74
75 LaxVersionStr
76 StrictVersionStr
77 Lax and strict version strings use the is_lax and is_strict methods
78 from "version" to check if the given string would be a valid lax or
79 strict version. version::Internals covers the details but basically:
80 lax versions are everything you may do, and strict omit many of the
81 usages best avoided.
82
83 VersionObject
84 Just for good measure, this type is included to check if a value is a
85 version object. Coercions from LaxVersionStr (and thus
86 StrictVersionStr) are provided.
87
89 Ricardo SIGNES <cpan@semiotic.systems>
90
92 • Karen Etheridge <ether@cpan.org>
93
94 • Ricardo Signes <rjbs@semiotic.systems>
95
97 This software is copyright (c) 2022 by Ricardo SIGNES.
98
99 This is free software; you can redistribute it and/or modify it under
100 the same terms as the Perl 5 programming language system itself.
101
102
103
104perl v5.36.0 2023-01-20 MooseX::Types::Perl(3)