← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:22 2010

File /usr/local/lib/perl5/site_perl/5.10.1/MooseX/Types/UndefinedType.pm
Statements Executed 96
Statement Execution Time 573µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
502273µs73µsMooseX::Types::UndefinedType::::nameMooseX::Types::UndefinedType::name
101152µs52µsMooseX::Types::UndefinedType::::newMooseX::Types::UndefinedType::new
101134µs46µsMooseX::Types::UndefinedType::::__ANON__[:15]MooseX::Types::UndefinedType::__ANON__[:15]
11116µs34µsMooseX::Types::UndefinedType::::BEGIN@9MooseX::Types::UndefinedType::BEGIN@9
11110µs50µsMooseX::Types::UndefinedType::::BEGIN@15MooseX::Types::UndefinedType::BEGIN@15
101019µs9µsMooseX::Types::UndefinedType::::DESTROYMooseX::Types::UndefinedType::DESTROY
1118µs12µsMooseX::Types::UndefinedType::::BEGIN@10MooseX::Types::UndefinedType::BEGIN@10
1117µs110µsMooseX::Types::UndefinedType::::BEGIN@13MooseX::Types::UndefinedType::BEGIN@13
1113µs3µsMooseX::Types::UndefinedType::::BEGIN@12MooseX::Types::UndefinedType::BEGIN@12
0000s0sMooseX::Types::UndefinedType::::AUTOLOADMooseX::Types::UndefinedType::AUTOLOAD
0000s0sMooseX::Types::UndefinedType::::__autovivifyMooseX::Types::UndefinedType::__autovivify
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package MooseX::Types::UndefinedType;
2
3=head1 NAME
4
5MooseX::Types::UndefinedType - Represents a not yet defined type
6
7=cut
8
9323µs252µs
# spent 34µs (16+18) within MooseX::Types::UndefinedType::BEGIN@9 which was called # once (16µs+18µs) by MooseX::Types::BEGIN@14 at line 9
use warnings;
# spent 34µs making 1 call to MooseX::Types::UndefinedType::BEGIN@9 # spent 18µs making 1 call to warnings::import
10318µs216µs
# spent 12µs (8+4) within MooseX::Types::UndefinedType::BEGIN@10 which was called # once (8µs+4µs) by MooseX::Types::BEGIN@14 at line 10
use strict;
# spent 12µs making 1 call to MooseX::Types::UndefinedType::BEGIN@10 # spent 4µs making 1 call to strict::import
11
12318µs13µs
# spent 3µs within MooseX::Types::UndefinedType::BEGIN@12 which was called # once (3µs+0s) by MooseX::Types::BEGIN@14 at line 12
use Moose::Util::TypeConstraints ();
# spent 3µs making 1 call to MooseX::Types::UndefinedType::BEGIN@12
13346µs2212µs
# spent 110µs (7+103) within MooseX::Types::UndefinedType::BEGIN@13 which was called # once (7µs+103µs) by MooseX::Types::BEGIN@14 at line 13
use Carp::Clan qw( ^MooseX::Types );
# spent 110µs making 1 call to MooseX::Types::UndefinedType::BEGIN@13 # spent 103µs making 1 call to Carp::Clan::import
14
151027µs1012µs
# spent 46µs (34+12) within MooseX::Types::UndefinedType::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/MooseX/Types/UndefinedType.pm:15] which was called 10 times, avg 5µs/call: # 10 times (34µs+12µs) by MooseX::Types::TypeDecorator::new at line 69 of MooseX/Types/TypeDecorator.pm, avg 5µs/call # spent 50µs (10+39) within MooseX::Types::UndefinedType::BEGIN@15 which was called # once (10µs+39µs) by MooseX::Types::BEGIN@14 at line 16
use overload '""' => sub { shift->name },
# spent 12µs making 10 calls to MooseX::Types::UndefinedType::name, avg 1µs/call
163229µs289µs fallback => 1;
# spent 50µs making 1 call to MooseX::Types::UndefinedType::BEGIN@15 # spent 39µs making 1 call to overload::import
17
18=head1 DESCRIPTION
19
20Whenever a type handle function (e.g. C<Int()> can't find a type
21constraint under it's full name, it assumes it has not yet been defined.
22It will then return an instance of this class, handling only
23stringification, name and possible identification of undefined types.
24
25Later, when you try to use the Undefined Type Constraint, autovivification will
26be attempted.
27
28=head1 METHODS
29
30=head2 new
31
32Takes a full type name as argument and returns an instance of this
33class.
34
35=cut
36
37
# spent 52µs within MooseX::Types::UndefinedType::new which was called 10 times, avg 5µs/call: # 10 times (52µs+0s) by __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfDateTime or __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfInt or __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfIntAsStr or __TYPE__::SimpleDB::Class::Types::SdbArrayRefOfStr or __TYPE__::SimpleDB::Class::Types::SdbDateTime or __TYPE__::SimpleDB::Class::Types::SdbHashRef or __TYPE__::SimpleDB::Class::Types::SdbInt or __TYPE__::SimpleDB::Class::Types::SdbIntAsStr or __TYPE__::SimpleDB::Class::Types::SdbMediumStr or __TYPE__::SimpleDB::Class::Types::SdbStr at line 403 of MooseX/Types.pm, avg 5µs/call
sub new {
381069µs return bless { name => $_[1] }, $_[0];
39}
40
41=head2 name
42
43Returns the stored type name.
44
45=cut
46
47
# spent 73µs within MooseX::Types::UndefinedType::name which was called 50 times, avg 1µs/call: # 40 times (61µs+0s) by MooseX::Types::TypeDecorator::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/MooseX/Types/TypeDecorator.pm:20] at line 15 of MooseX/Types/TypeDecorator.pm, avg 2µs/call # 10 times (12µs+0s) by MooseX::Types::UndefinedType::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/MooseX/Types/UndefinedType.pm:15] at line 15, avg 1µs/call
sub name {
4850119µs return $_[0]->{name};
49}
50
51=head2 __autovivify
52
53Try to see if the type constraint has yet been defined and if so create it.
54
55=cut
56
57sub __autovivify {
58 my ($self) = @_;
59 if(my $tc = $self->{instance}) {
60 return $tc;
61 } elsif( my $new_tc = Moose::Util::TypeConstraints::find_type_constraint($self->name)) {
62 $self->{instance} = $new_tc;
63 return $new_tc;
64 } else {
65 return;
66 }
67}
68
69=head2 AUTOLOAD
70
71Try to autovivify and delegate
72
73=cut
74
75sub AUTOLOAD {
76 my ($self, @args) = @_;
77 my ($method) = our $AUTOLOAD =~ /([^:]+)$/;
78
79 if(my $type_constraint = $self->__autovivify) {
80 return $type_constraint->$method(@args);
81 } else {
82 croak "Method '$method' is not supported for " . $self->name;
83 }
84}
85
86=head2 DESTROY
87
88Moose::Meta::TypeConstraint::Parameterizable complains if this isn't here. TODO
89to find out why.
90
91=cut
92
93
# spent 9µs within MooseX::Types::UndefinedType::DESTROY which was called 10 times, avg 930ns/call: # once (4µs+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 120 of ../lib/SimpleDB/Class/Types.pm # once (1µs+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 93 of ../lib/SimpleDB/Class/Types.pm # once (600ns+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 103 of ../lib/SimpleDB/Class/Types.pm # once (600ns+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 95 of ../lib/SimpleDB/Class/Types.pm # once (600ns+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 108 of ../lib/SimpleDB/Class/Types.pm # once (600ns+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 114 of ../lib/SimpleDB/Class/Types.pm # once (600ns+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 112 of ../lib/SimpleDB/Class/Types.pm # once (500ns+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 156 of ../lib/SimpleDB/Class/Types.pm # once (500ns+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 98 of ../lib/SimpleDB/Class/Types.pm # once (500ns+0s) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 117 of ../lib/SimpleDB/Class/Types.pm
sub DESTROY {
941020µs return;
95}
96
97=head1 SEE ALSO
98
99L<MooseX::Types::Moose>,
100L<Moose::Util::TypeConstraints>,
101L<Moose::Meta::TypeConstraint>,
102L<Carp::Clan>
103
104=head1 AUTHOR
105
106See L<MooseX::Types/AUTHOR>.
107
108=head1 LICENSE
109
110This program is free software; you can redistribute it and/or modify
111it under the same terms as perl itself.
112
113=cut
114
115
11612µs1;