← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:07 2010

File /usr/local/lib/perl/5.10.0/Moose/Meta/TypeConstraint.pm
Statements Executed 682
Total Time 0.0042152 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2262505µs2.49msMoose::Meta::TypeConstraint::::newMoose::Meta::TypeConstraint::new
2911224µs1.10msMoose::Meta::TypeConstraint::::_actually_compile_type_constraintMoose::Meta::TypeConstraint::_actually_compile_type_constraint
2922198µs1.46msMoose::Meta::TypeConstraint::::compile_type_constraintMoose::Meta::TypeConstraint::compile_type_constraint
1711179µs1.80msMoose::Meta::TypeConstraint::::create_child_typeMoose::Meta::TypeConstraint::create_child_type
511152µs405µsMoose::Meta::TypeConstraint::::_compile_subtypeMoose::Meta::TypeConstraint::_compile_subtype
2311152µs258µsMoose::Meta::TypeConstraint::::_compile_hand_optimized_type_constraintMoose::Meta::TypeConstraint::_compile_hand_optimized_type_constraint
51160µs114µsMoose::Meta::TypeConstraint::::_collect_all_parentsMoose::Meta::TypeConstraint::_collect_all_parents
82252µs52µsMoose::Meta::TypeConstraint::::__ANON__[:32]Moose::Meta::TypeConstraint::__ANON__[:32]
11114µs31µsMoose::Meta::TypeConstraint::::_compile_typeMoose::Meta::TypeConstraint::_compile_type
0000s0sMoose::Meta::TypeConstraint::::BEGINMoose::Meta::TypeConstraint::BEGIN
0000s0sMoose::Meta::TypeConstraint::::__ANON__[:10]Moose::Meta::TypeConstraint::__ANON__[:10]
0000s0sMoose::Meta::TypeConstraint::::__ANON__[:255]Moose::Meta::TypeConstraint::__ANON__[:255]
0000s0sMoose::Meta::TypeConstraint::::__ANON__[:268]Moose::Meta::TypeConstraint::__ANON__[:268]
0000s0sMoose::Meta::TypeConstraint::::__ANON__[:281]Moose::Meta::TypeConstraint::__ANON__[:281]
0000s0sMoose::Meta::TypeConstraint::::__ANON__[:28]Moose::Meta::TypeConstraint::__ANON__[:28]
0000s0sMoose::Meta::TypeConstraint::::__ANON__[:8]Moose::Meta::TypeConstraint::__ANON__[:8]
0000s0sMoose::Meta::TypeConstraint::::__ANON__[:9]Moose::Meta::TypeConstraint::__ANON__[:9]
0000s0sMoose::Meta::TypeConstraint::::assert_validMoose::Meta::TypeConstraint::assert_valid
0000s0sMoose::Meta::TypeConstraint::::checkMoose::Meta::TypeConstraint::check
0000s0sMoose::Meta::TypeConstraint::::coerceMoose::Meta::TypeConstraint::coerce
0000s0sMoose::Meta::TypeConstraint::::equalsMoose::Meta::TypeConstraint::equals
0000s0sMoose::Meta::TypeConstraint::::get_messageMoose::Meta::TypeConstraint::get_message
0000s0sMoose::Meta::TypeConstraint::::is_a_type_ofMoose::Meta::TypeConstraint::is_a_type_of
0000s0sMoose::Meta::TypeConstraint::::is_subtype_ofMoose::Meta::TypeConstraint::is_subtype_of
0000s0sMoose::Meta::TypeConstraint::::parentsMoose::Meta::TypeConstraint::parents
0000s0sMoose::Meta::TypeConstraint::::validateMoose::Meta::TypeConstraint::validate
LineStmts.Exclusive
Time
Avg.Code
1
2package Moose::Meta::TypeConstraint;
3
4329µs10µsuse strict;
# spent 10µs making 1 call to strict::import
5327µs9µsuse warnings;
# spent 26µs making 1 call to warnings::import
63197µs66µsuse metaclass;
# spent 1.01ms making 1 call to metaclass::import
7
8use overload '0+' => sub { refaddr(shift) }, # id an object
9 '""' => sub { shift->name }, # stringify to tc name
109946µs464ns bool => sub { 1 },
11349µs16µs fallback => 1;
# spent 70µs making 1 call to overload::import
12
13335µs12µsuse Scalar::Util qw(blessed refaddr);
# spent 57µs making 1 call to Exporter::import
14333µs11µsuse Sub::Name qw(subname);
# spent 43µs making 1 call to Exporter::import
15
1631.73ms575µsuse base qw(Class::MOP::Object);
# spent 71µs making 1 call to base::import
17
181900ns900nsour $VERSION = '1.15';
19124µs24µs$VERSION = eval $VERSION;
201600ns600nsour $AUTHORITY = 'cpan:STEVAN';
21
22125µs25µs__PACKAGE__->meta->add_attribute('name' => (reader => 'name'));
# spent 774µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 38µs making 1 call to Moose::Meta::TypeConstraint::meta
23111µs11µs__PACKAGE__->meta->add_attribute('parent' => (
# spent 794µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 21µs making 1 call to Moose::Meta::TypeConstraint::meta
24 reader => 'parent',
25 predicate => 'has_parent',
26));
27
2813µs3µsmy $null_constraint = sub { 1 };
29__PACKAGE__->meta->add_attribute('constraint' => (
30 reader => 'constraint',
31 writer => '_set_constraint',
32813µs2µs
# spent 52µs within Moose::Meta::TypeConstraint::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/TypeConstraint.pm:32] which was called 8 times, avg 7µs/call: # 7 times (43µs+0s) by Class::MOP::Method::Generated::__ANON__[(eval 0)[/usr/local/lib/perl/5.10.0/Class/MOP/Method/Generated.pm:53]:38] at line 35 of (eval 0)[/usr/local/lib/perl/5.10.0/Class/MOP/Method/Generated.pm:53] at line 53 of /usr/local/lib/perl/5.10.0/Class/MOP/Method/Generated.pm, avg 6µs/call # once (10µs+0s) by Class::MOP::Method::Generated::__ANON__[(eval 0)[/usr/local/lib/perl/5.10.0/Class/MOP/Method/Generated.pm:53]:35] at line 26 of (eval 0)[/usr/local/lib/perl/5.10.0/Class/MOP/Method/Generated.pm:53] at line 53 of /usr/local/lib/perl/5.10.0/Class/MOP/Method/Generated.pm
default => sub { $null_constraint }
33118µs18µs));
# spent 791µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 25µs making 1 call to Moose::Meta::TypeConstraint::meta
34110µs10µs__PACKAGE__->meta->add_attribute('message' => (
# spent 711µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 24µs making 1 call to Moose::Meta::TypeConstraint::meta
35 accessor => 'message',
36 predicate => 'has_message'
37));
38120µs20µs__PACKAGE__->meta->add_attribute('coercion' => (
# spent 735µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 24µs making 1 call to Moose::Meta::TypeConstraint::meta
39 accessor => 'coercion',
40 predicate => 'has_coercion'
41));
42
43118µs18µs__PACKAGE__->meta->add_attribute('hand_optimized_type_constraint' => (
# spent 1.71ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 22µs making 1 call to Moose::Meta::TypeConstraint::meta
44 init_arg => 'optimized',
45 accessor => 'hand_optimized_type_constraint',
46 predicate => 'has_hand_optimized_type_constraint',
47));
48
49sub parents {
50 my $self;
51 $self->parent;
52}
53
54# private accessors
55
56118µs18µs__PACKAGE__->meta->add_attribute('compiled_type_constraint' => (
# spent 742µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 30µs making 1 call to Moose::Meta::TypeConstraint::meta
57 accessor => '_compiled_type_constraint',
58 predicate => '_has_compiled_type_constraint'
59));
60115µs15µs__PACKAGE__->meta->add_attribute('package_defined_in' => (
# spent 445µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 25µs making 1 call to Moose::Meta::TypeConstraint::meta
61 accessor => '_package_defined_in'
62));
63
64
# spent 2.49ms (505µs+1.98) within Moose::Meta::TypeConstraint::new which was called 22 times, avg 113µs/call: # 17 times (355µs+1.26ms) by Moose::Meta::TypeConstraint::create_child_type at line 300, avg 95µs/call # once (41µs+212µs) at line 788 of /usr/local/lib/perl/5.10.0/Moose/Util/TypeConstraints.pm # once (31µs+205µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 557 of /usr/local/lib/perl/5.10.0/Moose/Util/TypeConstraints.pm # once (22µs+191µs) at line 847 of /usr/local/lib/perl/5.10.0/Moose/Util/TypeConstraints.pm # once (27µs+61µs) at line 809 of /usr/local/lib/perl/5.10.0/Moose/Util/TypeConstraints.pm # once (29µs+50µs) at line 830 of /usr/local/lib/perl/5.10.0/Moose/Util/TypeConstraints.pm
sub new {
65154621µs4µs my $class = shift;
66 my ($first, @rest) = @_;
67 my %args = ref $first ? %$first : $first ? ($first, @rest) : ();
68 $args{name} = $args{name} ? "$args{name}" : "__ANON__";
69
70 my $self = $class->_new(%args);
# spent 483µs making 18 calls to Moose::Meta::TypeConstraint::_new, avg 27µs/call # spent 234µs making 4 calls to Moose::Meta::TypeConstraint::Parameterizable::_new, avg 59µs/call
71 $self->compile_type_constraint()
# spent 1.17ms making 22 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 53µs/call # spent 94µs making 22 calls to Moose::Meta::TypeConstraint::_has_compiled_type_constraint, avg 4µs/call
72 unless $self->_has_compiled_type_constraint;
73 return $self;
74}
75
76
77
78sub coerce {
79 my $self = shift;
80
81 my $coercion = $self->coercion;
82
83 unless ($coercion) {
84 require Moose;
85 Moose->throw_error("Cannot coerce without a type coercion");
86 }
87
88 return $_[0] if $self->check($_[0]);
89
90 return $coercion->coerce(@_);
91}
92
93sub check {
94 my ($self, @args) = @_;
95 my $constraint_subref = $self->_compiled_type_constraint;
96 return $constraint_subref->(@args) ? 1 : undef;
97}
98
99sub validate {
100 my ($self, $value) = @_;
101 if ($self->_compiled_type_constraint->($value)) {
102 return undef;
103 }
104 else {
105 $self->get_message($value);
106 }
107}
108
109sub assert_valid {
110 my ($self, $value) = @_;
111
112 my $error = $self->validate($value);
113 return 1 if ! defined $error;
114
115 require Moose;
116 Moose->throw_error($error);
117}
118
119sub get_message {
120 my ($self, $value) = @_;
121 if (my $msg = $self->message) {
122 local $_ = $value;
123 return $msg->($value);
124 }
125 else {
126 $value = (defined $value ? overload::StrVal($value) : 'undef');
127 return "Validation failed for '" . $self->name . "' with value $value";
128 }
129}
130
131## type predicates ...
132
133sub equals {
134 my ( $self, $type_or_name ) = @_;
135
136 my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name) or return;
137
138 return 1 if $self == $other;
139
140 if ( $self->has_hand_optimized_type_constraint and $other->has_hand_optimized_type_constraint ) {
141 return 1 if $self->hand_optimized_type_constraint == $other->hand_optimized_type_constraint;
142 }
143
144 return unless $self->constraint == $other->constraint;
145
146 if ( $self->has_parent ) {
147 return unless $other->has_parent;
148 return unless $self->parent->equals( $other->parent );
149 } else {
150 return if $other->has_parent;
151 }
152
153 return;
154}
155
156sub is_a_type_of {
157 my ($self, $type_or_name) = @_;
158
159 my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name) or return;
160
161 ($self->equals($type) || $self->is_subtype_of($type));
162}
163
164sub is_subtype_of {
165 my ($self, $type_or_name) = @_;
166
167 my $type = Moose::Util::TypeConstraints::find_type_constraint($type_or_name) or return;
168
169 my $current = $self;
170
171 while (my $parent = $current->parent) {
172 return 1 if $parent->equals($type);
173 $current = $parent;
174 }
175
176 return 0;
177}
178
179## compiling the type constraint
180
181
# spent 1.46ms (198µs+1.26) within Moose::Meta::TypeConstraint::compile_type_constraint which was called 29 times, avg 50µs/call: # 22 times (135µs+1.03ms) by Moose::Meta::TypeConstraint::new at line 71, avg 53µs/call # 7 times (63µs+230µs) by Moose::Meta::TypeConstraint::Class::new at line 27 of /usr/local/lib/perl/5.10.0/Moose/Meta/TypeConstraint/Class.pm, avg 42µs/call
sub compile_type_constraint {
18258256µs4µs my $self = shift;
183 $self->_compiled_type_constraint($self->_actually_compile_type_constraint);
# spent 1.10ms making 29 calls to Moose::Meta::TypeConstraint::_actually_compile_type_constraint, avg 38µs/call # spent 167µs making 29 calls to Moose::Meta::TypeConstraint::_compiled_type_constraint, avg 6µs/call
184}
185
186## type compilers ...
187
188
# spent 1.10ms (224µs+873µs) within Moose::Meta::TypeConstraint::_actually_compile_type_constraint which was called 29 times, avg 38µs/call: # 29 times (224µs+873µs) by Moose::Meta::TypeConstraint::compile_type_constraint at line 183, avg 38µs/call
sub _actually_compile_type_constraint {
18977342µs4µs my $self = shift;
190
191 return $self->_compile_hand_optimized_type_constraint
# spent 258µs making 23 calls to Moose::Meta::TypeConstraint::_compile_hand_optimized_type_constraint, avg 11µs/call # spent 125µs making 29 calls to Moose::Meta::TypeConstraint::has_hand_optimized_type_constraint, avg 4µs/call
192 if $self->has_hand_optimized_type_constraint;
193
194 my $check = $self->constraint;
# spent 29µs making 6 calls to Moose::Meta::TypeConstraint::constraint, avg 5µs/call
195 unless ( defined $check ) {
196 require Moose;
197 Moose->throw_error( "Could not compile type constraint '"
198 . $self->name
199 . "' because no constraint check" );
200 }
201
202 return $self->_compile_subtype($check)
# spent 405µs making 5 calls to Moose::Meta::TypeConstraint::_compile_subtype, avg 81µs/call # spent 23µs making 6 calls to Moose::Meta::TypeConstraint::has_parent, avg 4µs/call
203 if $self->has_parent;
204
205 return $self->_compile_type($check);
# spent 31µs making 1 call to Moose::Meta::TypeConstraint::_compile_type
206}
207
208
# spent 258µs (152+107) within Moose::Meta::TypeConstraint::_compile_hand_optimized_type_constraint which was called 23 times, avg 11µs/call: # 23 times (152µs+107µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 191, avg 11µs/call
sub _compile_hand_optimized_type_constraint {
20992133µs1µs my $self = shift;
210
211 my $type_constraint = $self->hand_optimized_type_constraint;
# spent 107µs making 23 calls to Moose::Meta::TypeConstraint::hand_optimized_type_constraint, avg 5µs/call
212
213 unless ( ref $type_constraint ) {
214 require Moose;
215 Carp::confess ("Hand optimized type constraint for " . $self->name . " is not a code reference");
216 Moose->throw_error("Hand optimized type constraint is not a code reference");
217 }
218
219 return $type_constraint;
220}
221
222
# spent 405µs (152+253) within Moose::Meta::TypeConstraint::_compile_subtype which was called 5 times, avg 81µs/call: # 5 times (152µs+253µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 202, avg 81µs/call
sub _compile_subtype {
22363238µs4µs my ($self, $check) = @_;
224
225 # gather all the parent constraintss in order
226 my @parents;
227 my $optimized_parent;
228 foreach my $parent ($self->_collect_all_parents) {
# spent 114µs making 5 calls to Moose::Meta::TypeConstraint::_collect_all_parents, avg 23µs/call
229 # if a parent is optimized, the optimized constraint already includes
230 # all of its parents tcs, so we can break the loop
231 if ($parent->has_hand_optimized_type_constraint) {
# spent 32µs making 9 calls to Moose::Meta::TypeConstraint::has_hand_optimized_type_constraint, avg 4µs/call
232 push @parents => $optimized_parent = $parent->hand_optimized_type_constraint;
233 last;
234 }
235 else {
236 push @parents => $parent->constraint;
# spent 43µs making 9 calls to Moose::Meta::TypeConstraint::constraint, avg 5µs/call
237 }
238 }
239
240 @parents = grep { $_ != $null_constraint } reverse @parents;
241
242 unless ( @parents ) {
243 return $self->_compile_type($check);
244 } elsif( $optimized_parent and @parents == 1 ) {
245 # the case of just one optimized parent is optimized to prevent
246 # looping and the unnecessary localization
247 if ( $check == $null_constraint ) {
248 return $optimized_parent;
249 } else {
250 return subname($self->name, sub {
251 return undef unless $optimized_parent->($_[0]);
252 my (@args) = @_;
253 local $_ = $args[0];
254 $check->(@args);
255 });
256 }
257 } else {
258 # general case, check all the constraints, from the first parent to ourselves
259 my @checks = @parents;
260 push @checks, $check if $check != $null_constraint;
261 return subname($self->name => sub {
262 my (@args) = @_;
263 local $_ = $args[0];
264 foreach my $check (@checks) {
265 return undef unless $check->(@args);
266 }
267 return 1;
268 });
# spent 39µs making 5 calls to Sub::Name::subname, avg 8µs/call # spent 25µs making 5 calls to Moose::Meta::TypeConstraint::name, avg 5µs/call
269 }
270}
271
272
# spent 31µs (14+17) within Moose::Meta::TypeConstraint::_compile_type which was called # once (14µs+17µs) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 205
sub _compile_type {
273324µs8µs my ($self, $check) = @_;
274
275 return $check if $check == $null_constraint; # Item, Any
276
277 return subname($self->name => sub {
278 my (@args) = @_;
279 local $_ = $args[0];
280 $check->(@args);
281 });
# spent 10µs making 1 call to Moose::Meta::TypeConstraint::name # spent 8µs making 1 call to Sub::Name::subname
282}
283
284## other utils ...
285
286
# spent 114µs (60+54) within Moose::Meta::TypeConstraint::_collect_all_parents which was called 5 times, avg 23µs/call: # 5 times (60µs+54µs) by Moose::Meta::TypeConstraint::_compile_subtype at line 228, avg 23µs/call
sub _collect_all_parents {
2874379µs2µs my $self = shift;
288 my @parents;
289 my $current = $self->parent;
# spent 24µs making 5 calls to Moose::Meta::TypeConstraint::parent, avg 5µs/call
290 while (defined $current) {
291 push @parents => $current;
292 $current = $current->parent;
# spent 30µs making 9 calls to Moose::Meta::TypeConstraint::parent, avg 3µs/call
293 }
294 return @parents;
295}
296
297
# spent 1.80ms (179µs+1.62) within Moose::Meta::TypeConstraint::create_child_type which was called 17 times, avg 106µs/call: # 17 times (179µs+1.62ms) by Moose::Util::TypeConstraints::_create_type_constraint at line 547 of /usr/local/lib/perl/5.10.0/Moose/Util/TypeConstraints.pm, avg 106µs/call
sub create_child_type {
29851174µs3µs my ($self, %opts) = @_;
299 my $class = ref $self;
300 return $class->new(%opts, parent => $self);
# spent 1.62ms making 17 calls to Moose::Meta::TypeConstraint::new, avg 95µs/call
301}
302
303132µs32µs1;
304
305__END__
306
307=pod
308
309=head1 NAME
310
311Moose::Meta::TypeConstraint - The Moose Type Constraint metaclass
312
313=head1 DESCRIPTION
314
315This class represents a single type constraint. Moose's built-in type
316constraints, as well as constraints you define, are all stored in a
317L<Moose::Meta::TypeConstraint::Registry> object as objects of this
318class.
319
320=head1 INHERITANCE
321
322C<Moose::Meta::TypeConstraint> is a subclass of L<Class::MOP::Object>.
323
324=head1 METHODS
325
326=over 4
327
328=item B<< Moose::Meta::TypeConstraint->new(%options) >>
329
330This creates a new type constraint based on the provided C<%options>:
331
332=over 8
333
334=item * name
335
336The constraint name. If a name is not provided, it will be set to
337"__ANON__".
338
339=item * parent
340
341A C<Moose::Meta::TypeConstraint> object which is the parent type for
342the type being created. This is optional.
343
344=item * constraint
345
346This is the subroutine reference that implements the actual constraint
347check. This defaults to a subroutine which always returns true.
348
349=item * message
350
351A subroutine reference which is used to generate an error message when
352the constraint fails. This is optional.
353
354=item * coercion
355
356A L<Moose::Meta::TypeCoercion> object representing the coercions to
357the type. This is optional.
358
359=item * optimized
360
361This is a variant of the C<constraint> parameter that is somehow
362optimized. Typically, this means incorporating both the type's
363constraint and all of its parents' constraints into a single
364subroutine reference.
365
366=back
367
368=item B<< $constraint->equals($type_name_or_object) >>
369
370Returns true if the supplied name or type object is the same as the
371current type.
372
373=item B<< $constraint->is_subtype_of($type_name_or_object) >>
374
375Returns true if the supplied name or type object is a parent of the
376current type.
377
378=item B<< $constraint->is_a_type_of($type_name_or_object) >>
379
380Returns true if the given type is the same as the current type, or is
381a parent of the current type. This is a shortcut for checking
382C<equals> and C<is_subtype_of>.
383
384=item B<< $constraint->coerce($value) >>
385
386This will attempt to coerce the value to the type. If the type does
387have any defined coercions this will throw an error.
388
389=item B<< $constraint->check($value) >>
390
391Returns true if the given value passes the constraint for the type.
392
393=item B<< $constraint->validate($value) >>
394
395This is similar to C<check>. However, if the type I<is valid> then the
396method returns an explicit C<undef>. If the type is not valid, we call
397C<< $self->get_message($value) >> internally to generate an error
398message.
399
400=item B<< $constraint->assert_valid($value) >>
401
402Like C<check> and C<validate>, this method checks whether C<$value> is
403valid under the constraint. If it is, it will return true. If it is not,
404an exception will be thrown with the results of
405C<< $self->get_message($value) >>.
406
407=item B<< $constraint->name >>
408
409Returns the type's name, as provided to the constructor.
410
411=item B<< $constraint->parent >>
412
413Returns the type's parent, as provided to the constructor, if any.
414
415=item B<< $constraint->has_parent >>
416
417Returns true if the type has a parent type.
418
419=item B<< $constraint->parents >>
420
421A synonym for C<parent>. This is useful for polymorphism with types
422that can have more than one parent.
423
424=item B<< $constraint->constraint >>
425
426Returns the type's constraint, as provided to the constructor.
427
428=item B<< $constraint->get_message($value) >>
429
430This generates a method for the given value. If the type does not have
431an explicit message, we generate a default message.
432
433=item B<< $constraint->has_message >>
434
435Returns true if the type has a message.
436
437=item B<< $constraint->message >>
438
439Returns the type's message as a subroutine reference.
440
441=item B<< $constraint->coercion >>
442
443Returns the type's L<Moose::Meta::TypeCoercion> object, if one
444exists.
445
446=item B<< $constraint->has_coercion >>
447
448Returns true if the type has a coercion.
449
450=item B<< $constraint->hand_optimized_type_constraint >>
451
452Returns the type's hand optimized constraint, as provided to the
453constructor via the C<optimized> option.
454
455=item B<< $constraint->has_hand_optimized_type_constraint >>
456
457Returns true if the type has an optimized constraint.
458
459=item B<< $constraint->create_child_type(%options) >>
460
461This returns a new type constraint of the same class using the
462provided C<%options>. The C<parent> option will be the current type.
463
464This method exists so that subclasses of this class can override this
465behavior and change how child types are created.
466
467=back
468
469=head1 BUGS
470
471See L<Moose/BUGS> for details on reporting bugs.
472
473=head1 AUTHOR
474
475Stevan Little E<lt>stevan@iinteractive.comE<gt>
476
477=head1 COPYRIGHT AND LICENSE
478
479Copyright 2006-2010 by Infinity Interactive, Inc.
480
481L<http://www.iinteractive.com>
482
483This library is free software; you can redistribute it and/or modify
484it under the same terms as Perl itself.
485
486=cut