← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:14 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/TypeCoercion/Union.pm
StatementsExecuted 14 statements in 293µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11110µs10µsMoose::Meta::TypeCoercion::Union::::BEGIN@3Moose::Meta::TypeCoercion::Union::BEGIN@3
1116µs26µsMoose::Meta::TypeCoercion::Union::::BEGIN@14Moose::Meta::TypeCoercion::Union::BEGIN@14
1116µs9µsMoose::Meta::TypeCoercion::Union::::BEGIN@11Moose::Meta::TypeCoercion::Union::BEGIN@11
1116µs54µsMoose::Meta::TypeCoercion::Union::::BEGIN@16Moose::Meta::TypeCoercion::Union::BEGIN@16
1116µs18µsMoose::Meta::TypeCoercion::Union::::BEGIN@10Moose::Meta::TypeCoercion::Union::BEGIN@10
1115µs335µ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 10µs within Moose::Meta::TypeCoercion::Union::BEGIN@3 which was called: # once (10µs+0s) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 5
BEGIN {
414µs $Moose::Meta::TypeCoercion::Union::AUTHORITY = 'cpan:STEVAN';
5126µs110µs}
# spent 10µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@3
6{
72900ns $Moose::Meta::TypeCoercion::Union::VERSION = '2.1005';
8}
9
10219µs230µs
# spent 18µs (6+12) within Moose::Meta::TypeCoercion::Union::BEGIN@10 which was called: # once (6µs+12µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 10
use strict;
# spent 18µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@10 # spent 12µs making 1 call to strict::import
11221µs212µs
# spent 9µs (6+3) within Moose::Meta::TypeCoercion::Union::BEGIN@11 which was called: # once (6µs+3µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 11
use warnings;
# spent 9µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@11 # spent 3µs making 1 call to warnings::import
12224µs2665µs
# spent 335µs (5+330) within Moose::Meta::TypeCoercion::Union::BEGIN@12 which was called: # once (5µs+330µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 12
use metaclass;
# spent 335µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@12 # spent 330µs making 1 call to metaclass::import
13
14222µs246µs
# spent 26µs (6+20) within Moose::Meta::TypeCoercion::Union::BEGIN@14 which was called: # once (6µs+20µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 14
use Scalar::Util 'blessed';
# spent 26µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@14 # spent 20µs making 1 call to Exporter::import
15
162175µs2102µs
# spent 54µs (6+48) within Moose::Meta::TypeCoercion::Union::BEGIN@16 which was called: # once (6µs+48µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 16
use base 'Moose::Meta::TypeCoercion';
# spent 54µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@16 # spent 48µ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
4812µs1;
49
50# ABSTRACT: The Moose Type Coercion metaclass for Unions
51
52__END__