← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 09:58:41 2014
Reported on Tue Jun 24 09:59:22 2014

Filename/usr/local/lib/perl/5.14.2/Moose/Meta/TypeCoercion/Union.pm
StatementsExecuted 14 statements in 326µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1118µs11µsMoose::Meta::TypeCoercion::Union::::BEGIN@10Moose::Meta::TypeCoercion::Union::BEGIN@10
1117µs7µsMoose::Meta::TypeCoercion::Union::::BEGIN@3Moose::Meta::TypeCoercion::Union::BEGIN@3
1117µs33µsMoose::Meta::TypeCoercion::Union::::BEGIN@14Moose::Meta::TypeCoercion::Union::BEGIN@14
1117µs51µsMoose::Meta::TypeCoercion::Union::::BEGIN@16Moose::Meta::TypeCoercion::Union::BEGIN@16
1116µs11µsMoose::Meta::TypeCoercion::Union::::BEGIN@11Moose::Meta::TypeCoercion::Union::BEGIN@11
1116µs410µ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 7µs within Moose::Meta::TypeCoercion::Union::BEGIN@3 which was called: # once (7µs+0s) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 5
BEGIN {
415µs $Moose::Meta::TypeCoercion::Union::AUTHORITY = 'cpan:STEVAN';
5139µs17µs}
# spent 7µ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 (8+3) within Moose::Meta::TypeCoercion::Union::BEGIN@10 which was called: # once (8µ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
11219µs216µs
# spent 11µs (6+5) within Moose::Meta::TypeCoercion::Union::BEGIN@11 which was called: # once (6µs+5µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 11
use warnings;
# spent 11µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@11 # spent 5µs making 1 call to warnings::import
12229µs2814µs
# spent 410µs (6+404) within Moose::Meta::TypeCoercion::Union::BEGIN@12 which was called: # once (6µs+404µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 12
use metaclass;
# spent 410µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@12 # spent 404µs making 1 call to metaclass::import
13
14225µs260µs
# spent 33µs (7+26) within Moose::Meta::TypeCoercion::Union::BEGIN@14 which was called: # once (7µs+26µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 14
use Scalar::Util 'blessed';
# spent 33µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@14 # spent 26µs making 1 call to Exporter::import
15
162183µs295µs
# spent 51µs (7+44) within Moose::Meta::TypeCoercion::Union::BEGIN@16 which was called: # once (7µs+44µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 16
use base 'Moose::Meta::TypeCoercion';
# spent 51µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@16 # spent 44µ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__