← Index
NYTProf Performance Profile   « line view »
For fastest.pl
  Run on Fri Jan 31 20:48:16 2014
Reported on Fri Jan 31 20:49:41 2014

Filename/opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Meta/TypeCoercion/Union.pm
StatementsExecuted 14 statements in 480µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11113µs82µsMoose::Meta::TypeCoercion::Union::::BEGIN@16Moose::Meta::TypeCoercion::Union::BEGIN@16
11112µs12µsMoose::Meta::TypeCoercion::Union::::BEGIN@3Moose::Meta::TypeCoercion::Union::BEGIN@3
11110µs15µsMoose::Meta::TypeCoercion::Union::::BEGIN@11Moose::Meta::TypeCoercion::Union::BEGIN@11
1119µs40µsMoose::Meta::TypeCoercion::Union::::BEGIN@14Moose::Meta::TypeCoercion::Union::BEGIN@14
1119µs24µsMoose::Meta::TypeCoercion::Union::::BEGIN@10Moose::Meta::TypeCoercion::Union::BEGIN@10
1118µs496µsMoose::Meta::TypeCoercion::Union::::BEGIN@12Moose::Meta::TypeCoercion::Union::BEGIN@12
0000s0sMoose::Meta::TypeCoercion::Union::::__ANON__[:37]Moose::Meta::TypeCoercion::Union::__ANON__[:37]
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
# spent 12µs within Moose::Meta::TypeCoercion::Union::BEGIN@3 which was called: # once (12µs+0s) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 5
BEGIN {
417µs $Moose::Meta::TypeCoercion::Union::AUTHORITY = 'cpan:STEVAN';
5147µs112µs}
# spent 12µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@3
6{
721µs $Moose::Meta::TypeCoercion::Union::VERSION = '2.1005';
8}
9
10236µs240µs
# spent 24µs (9+15) within Moose::Meta::TypeCoercion::Union::BEGIN@10 which was called: # once (9µs+15µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 10
use strict;
# spent 24µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@10 # spent 15µs making 1 call to strict::import
11230µs220µs
# spent 15µs (10+5) within Moose::Meta::TypeCoercion::Union::BEGIN@11 which was called: # once (10µs+5µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 11
use warnings;
# spent 15µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@11 # spent 5µs making 1 call to warnings::import
12238µs2984µs
# spent 496µs (8+488) within Moose::Meta::TypeCoercion::Union::BEGIN@12 which was called: # once (8µs+488µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 12
use metaclass;
# spent 496µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@12 # spent 488µs making 1 call to metaclass::import
13
14247µs272µs
# spent 40µs (9+31) within Moose::Meta::TypeCoercion::Union::BEGIN@14 which was called: # once (9µs+31µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 14
use Scalar::Util 'blessed';
# spent 40µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@14 # spent 31µs making 1 call to Exporter::import
15
162270µs2150µs
# spent 82µs (13+69) within Moose::Meta::TypeCoercion::Union::BEGIN@16 which was called: # once (13µs+69µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 16
use base 'Moose::Meta::TypeCoercion';
# spent 82µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@16 # spent 69µs making 1 call to base::import
17
18sub compile_type_coercion {
19 my $self = shift;
20 my $type_constraint = $self->type_constraint;
21
22 (blessed $type_constraint && $type_constraint->isa('Moose::Meta::TypeConstraint::Union'))
23 || Moose->throw_error("You can only create a Moose::Meta::TypeCoercion::Union for a " .
24 "Moose::Meta::TypeConstraint::Union, not a $type_constraint");
25
26 $self->_compiled_type_coercion(
27 sub {
28 my $value = shift;
29
30 foreach my $type ( grep { $_->has_coercion }
31 @{ $type_constraint->type_constraints } ) {
32 my $temp = $type->coerce($value);
33 return $temp if $type_constraint->check($temp);
34 }
35
36 return $value;
37 }
38 );
39}
40
41sub has_coercion_for_type { 0 }
42
43sub add_type_coercions {
44 require Moose;
45 Moose->throw_error("Cannot add additional type coercions to Union types");
46}
47
4814µs1;
49
50# ABSTRACT: The Moose Type Coercion metaclass for Unions
51
52__END__