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.101343
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 ModuleName
32 PackageName
33 These types are identical, and expect a string that could be a package
34 or module name. That's basically a bunch of identifiers stuck together
35 with double-colons. One key quirk is that parts of the package name
36 after the first may begin with digits.
37
38 The use of an apostrophe as a package separator is not permitted.
39
40 DistName
41 The DistName type checks for a string like "MooseX-Types-Perl", the
42 sort of thing used to name CPAN distributions. In general, it's like
43 the more familiar ModuleName, but with hyphens instead of double-
44 colons.
45
46 In reality, a few distribution names may not match this pattern -- most
47 famously, "CGI.pm" is the name of the distribution that contains CGI.
48 These exceptions are few and far between, and deciding what a
49 "LaxDistName" type would look like has not seemed worth it, yet.
50
51 Identifier
52 An Identifier is something that could be used as a symbol name or other
53 identifier (filehandle, directory handle, subroutine name, format name,
54 or label). It's what you put after the sigil (dollar sign, at sign,
55 percent sign) in a variable name. Generally, it's a bunch of
56 alphanumeric characters not starting with a digit.
57
58 Although Perl identifiers may contain non-ASCII characters in some
59 circumstances, this type does not allow it. A "UnicodeIdentifier" type
60 may be added in the future.
61
62 SafeIdentifier
63 SafeIdentifiers are just like Identifiers, but omit the single-letter
64 variables underscore, a, and b, as these have special significance.
65
66 LaxVersionStr
67 StrictVersionStr
68 Lax and strict version strings use the is_lax and is_strict methods
69 from "version" to check if the given string would be a valid lax or
70 strict version. version::Internals covers the details but basically:
71 lax versions are everything you may do, and strict omit many of the
72 usages best avoided.
73
74 VersionObject
75 Just for good measure, this type is included to check if a value is a
76 version object. Coercions from LaxVersionStr (and thus
77 StrictVersionStr) are provided.
78
80 Ricardo SIGNES <rjbs@cpan.org>
81
83 This software is copyright (c) 2014 by Ricardo SIGNES.
84
85 This is free software; you can redistribute it and/or modify it under
86 the same terms as the Perl 5 programming language system itself.
87
88
89
90perl v5.34.0 2021-07-22 MooseX::Types::Perl(3)