← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:45:08 2010
Reported on Wed Nov 17 22:13:50 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeCoercion/Union.pm
StatementsExecuted 19 statements in 1.40ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11180µs98µsMoose::Meta::TypeCoercion::Union::::BEGIN@4Moose::Meta::TypeCoercion::Union::BEGIN@4
11149µs117µsMoose::Meta::TypeCoercion::Union::::BEGIN@5Moose::Meta::TypeCoercion::Union::BEGIN@5
11146µs3.02msMoose::Meta::TypeCoercion::Union::::BEGIN@6Moose::Meta::TypeCoercion::Union::BEGIN@6
11142µs444µsMoose::Meta::TypeCoercion::Union::::BEGIN@14Moose::Meta::TypeCoercion::Union::BEGIN@14
11140µs201µsMoose::Meta::TypeCoercion::Union::::BEGIN@8Moose::Meta::TypeCoercion::Union::BEGIN@8
0000s0sMoose::Meta::TypeCoercion::Union::::__ANON__[:35]Moose::Meta::TypeCoercion::Union::__ANON__[:35]
0000s0sMoose::Meta::TypeCoercion::Union::::add_type_coercionsMoose::Meta::TypeCoercion::Union::add_type_coercions
0000s0sMoose::Meta::TypeCoercion::Union::::compile_type_coercionMoose::Meta::TypeCoercion::Union::compile_type_coercion
0000s0sMoose::Meta::TypeCoercion::Union::::has_coercion_for_typeMoose::Meta::TypeCoercion::Union::has_coercion_for_type
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Moose::Meta::TypeCoercion::Union;
3
4397µs2115µs
# spent 98µs (80+18) within Moose::Meta::TypeCoercion::Union::BEGIN@4 which was called: # once (80µs+18µs) by Moose::Meta::TypeConstraint::Union::BEGIN@8 at line 4
use strict;
# spent 98µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@4 # spent 18µs making 1 call to strict::import
53103µs2184µs
# spent 117µs (49+67) within Moose::Meta::TypeCoercion::Union::BEGIN@5 which was called: # once (49µs+67µs) by Moose::Meta::TypeConstraint::Union::BEGIN@8 at line 5
use warnings;
# spent 117µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@5 # spent 67µs making 1 call to warnings::import
63146µs26.00ms
# spent 3.02ms (46µs+2.98) within Moose::Meta::TypeCoercion::Union::BEGIN@6 which was called: # once (46µs+2.98ms) by Moose::Meta::TypeConstraint::Union::BEGIN@8 at line 6
use metaclass;
# spent 3.02ms making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@6 # spent 2.98ms making 1 call to metaclass::import
7
83286µs2363µs
# spent 201µs (40+162) within Moose::Meta::TypeCoercion::Union::BEGIN@8 which was called: # once (40µs+162µs) by Moose::Meta::TypeConstraint::Union::BEGIN@8 at line 8
use Scalar::Util 'blessed';
# spent 201µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@8 # spent 162µs making 1 call to Exporter::import
9
1015µsour $VERSION = '1.19';
11159µs$VERSION = eval $VERSION;
# spent 10µs executing statements in string eval
1213µsour $AUTHORITY = 'cpan:STEVAN';
13
143692µs2845µs
# spent 444µs (42+402) within Moose::Meta::TypeCoercion::Union::BEGIN@14 which was called: # once (42µs+402µs) by Moose::Meta::TypeConstraint::Union::BEGIN@8 at line 14
use base 'Moose::Meta::TypeCoercion';
# spent 444µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@14 # spent 402µs making 1 call to base::import
15
16sub compile_type_coercion {
17 my $self = shift;
18 my $type_constraint = $self->type_constraint;
19
20 (blessed $type_constraint && $type_constraint->isa('Moose::Meta::TypeConstraint::Union'))
21 || Moose->throw_error("You can only create a Moose::Meta::TypeCoercion::Union for a " .
22 "Moose::Meta::TypeConstraint::Union, not a $type_constraint");
23
24 $self->_compiled_type_coercion(
25 sub {
26 my $value = shift;
27
28 foreach my $type ( grep { $_->has_coercion }
29 @{ $type_constraint->type_constraints } ) {
30 my $temp = $type->coerce($value);
31 return $temp if $type_constraint->check($temp);
32 }
33
34 return $value;
35 }
36 );
37}
38
39sub has_coercion_for_type { 0 }
40
41sub add_type_coercions {
42 require Moose;
43 Moose->throw_error("Cannot add additional type coercions to Union types");
44}
45
46111µs1;
47
48__END__