← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 10:04:38 2014
Reported on Tue Jun 24 10:05:32 2014

Filename/usr/local/lib/perl/5.14.2/Moose/Meta/TypeCoercion/Union.pm
StatementsExecuted 14 statements in 337µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1119µs9µsMoose::Meta::TypeCoercion::Union::::BEGIN@3Moose::Meta::TypeCoercion::Union::BEGIN@3
1119µs11µsMoose::Meta::TypeCoercion::Union::::BEGIN@10Moose::Meta::TypeCoercion::Union::BEGIN@10
1118µs34µsMoose::Meta::TypeCoercion::Union::::BEGIN@14Moose::Meta::TypeCoercion::Union::BEGIN@14
1117µs52µsMoose::Meta::TypeCoercion::Union::::BEGIN@16Moose::Meta::TypeCoercion::Union::BEGIN@16
1117µs12µsMoose::Meta::TypeCoercion::Union::::BEGIN@11Moose::Meta::TypeCoercion::Union::BEGIN@11
1116µs414µ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 9µs within Moose::Meta::TypeCoercion::Union::BEGIN@3 which was called: # once (9µs+0s) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 5
BEGIN {
415µs $Moose::Meta::TypeCoercion::Union::AUTHORITY = 'cpan:STEVAN';
5139µs19µs}
# spent 9µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@3
6{
721µs $Moose::Meta::TypeCoercion::Union::VERSION = '2.1005';
8}
9
10221µs214µs
# spent 11µs (9+3) within Moose::Meta::TypeCoercion::Union::BEGIN@10 which was called: # once (9µs+3µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 10
use strict;
# spent 11µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@10 # spent 3µs making 1 call to strict::import
11220µs216µs
# spent 12µs (7+5) within Moose::Meta::TypeCoercion::Union::BEGIN@11 which was called: # once (7µs+5µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 11
use warnings;
# spent 12µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@11 # spent 5µs making 1 call to warnings::import
12230µs2822µs
# spent 414µs (6+408) within Moose::Meta::TypeCoercion::Union::BEGIN@12 which was called: # once (6µs+408µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 12
use metaclass;
# spent 414µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@12 # spent 408µs making 1 call to metaclass::import
13
14225µs260µs
# spent 34µs (8+26) within Moose::Meta::TypeCoercion::Union::BEGIN@14 which was called: # once (8µs+26µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 14
use Scalar::Util 'blessed';
# spent 34µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@14 # spent 26µs making 1 call to Exporter::import
15
162193µs296µs
# spent 52µs (7+45) within Moose::Meta::TypeCoercion::Union::BEGIN@16 which was called: # once (7µs+45µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 16
use base 'Moose::Meta::TypeCoercion';
# spent 52µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@16 # spent 45µ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
4813µs1;
49
50# ABSTRACT: The Moose Type Coercion metaclass for Unions
51
52__END__