← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:23:33 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Meta/TypeCoercion/Union.pm
StatementsExecuted 19 statements in 318µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11159µs129µsMoose::Meta::TypeCoercion::Union::::BEGIN@16Moose::Meta::TypeCoercion::Union::BEGIN@16
11125µs37µsMoose::Meta::TypeCoercion::Union::::BEGIN@11Moose::Meta::TypeCoercion::Union::BEGIN@11
11110µs457µsMoose::Meta::TypeCoercion::Union::::BEGIN@12Moose::Meta::TypeCoercion::Union::BEGIN@12
1119µs9µsMoose::Meta::TypeCoercion::Union::::BEGIN@3Moose::Meta::TypeCoercion::Union::BEGIN@3
1118µs11µsMoose::Meta::TypeCoercion::Union::::BEGIN@10Moose::Meta::TypeCoercion::Union::BEGIN@10
1117µs41µsMoose::Meta::TypeCoercion::Union::::BEGIN@14Moose::Meta::TypeCoercion::Union::BEGIN@14
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 {
414µs $Moose::Meta::TypeCoercion::Union::AUTHORITY = 'cpan:STEVAN';
5123µs19µs}
# spent 9µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@3
6{
721µs $Moose::Meta::TypeCoercion::Union::VERSION = '2.0602';
8}
9
10318µ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
11318µs248µs
# spent 37µs (25+11) within Moose::Meta::TypeCoercion::Union::BEGIN@11 which was called: # once (25µs+11µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 11
use warnings;
# spent 37µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@11 # spent 12µs making 1 call to warnings::import
12326µs2903µs
# spent 457µs (10+447) within Moose::Meta::TypeCoercion::Union::BEGIN@12 which was called: # once (10µs+447µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 12
use metaclass;
# spent 457µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@12 # spent 447µs making 1 call to metaclass::import
13
14319µs275µs
# spent 41µs (7+34) within Moose::Meta::TypeCoercion::Union::BEGIN@14 which was called: # once (7µs+34µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 14
use Scalar::Util 'blessed';
# spent 41µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@14 # spent 34µs making 1 call to Exporter::import
15
163206µs2198µs
# spent 129µs (59+70) within Moose::Meta::TypeCoercion::Union::BEGIN@16 which was called: # once (59µs+70µs) by Moose::Meta::TypeConstraint::Union::BEGIN@14 at line 16
use base 'Moose::Meta::TypeCoercion';
# spent 129µs making 1 call to Moose::Meta::TypeCoercion::Union::BEGIN@16 # spent 70µ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
- -
54=pod
55
56=head1 NAME
57
58Moose::Meta::TypeCoercion::Union - The Moose Type Coercion metaclass for Unions
59
60=head1 VERSION
61
62version 2.0602
63
64=head1 DESCRIPTION
65
66This is a subclass of L<Moose::Meta::TypeCoercion> that is used for
67L<Moose::Meta::TypeConstraint::Union> objects.
68=head1 METHODS
69
70=over 4
71
72=item B<< $coercion->has_coercion_for_type >>
73
74This method always returns false.
75
76=item B<< $coercion->add_type_coercions >>
77
78This method always throws an error. You cannot add coercions to a
79union type coercion.
80
81=item B<< $coercion->coerce($value) >>
82
83This method will coerce by trying the coercions for each type in the
84union.
85
86=back
87
88=head1 BUGS
89
90See L<Moose/BUGS> for details on reporting bugs.
91
92=head1 AUTHOR
93
94Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
95
96=head1 COPYRIGHT AND LICENSE
97
98This software is copyright (c) 2012 by Infinity Interactive, Inc..
99
100This is free software; you can redistribute it and/or modify it under
101the same terms as the Perl 5 programming language system itself.
102
103=cut
104
105
106__END__