blob: 668c4f0dddb90189cb2b1878b65b54338a764108 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package MooseX::Validation::Doctypes;
use strict;
use warnings;
use MooseX::Meta::TypeConstraint::Doctype;
use Sub::Exporter -setup => {
exports => ['doctype'],
groups => {
default => ['doctype'],
},
};
sub doctype {
my $name;
$name = shift if @_ > 1;
my ($doctype) = @_;
# XXX validate name
my $args = {
($name ? (name => $name) : ()),
doctype => $doctype,
package_defined_in => scalar(caller),
};
my $tc = MooseX::Meta::TypeConstraint::Doctype->new($args);
Moose::Util::TypeConstraints::register_type_constraint($tc)
if $name;
return $tc;
}
1;
|