← 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:20 2010

File /usr/local/lib/perl5/site_perl/5.10.1/MooseX/Types/CheckedUtilExports.pm
Statements Executed 280
Statement Execution Time 765µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
6011242µs263µsMooseX::Types::CheckedUtilExports::::__ANON__[:63]MooseX::Types::CheckedUtilExports::__ANON__[:63]
22217µs506µsMooseX::Types::CheckedUtilExports::::class_typeMooseX::Types::CheckedUtilExports::class_type
11115µs18µsMooseX::Types::CheckedUtilExports::::BEGIN@10MooseX::Types::CheckedUtilExports::BEGIN@10
11111µs48µsMooseX::Types::CheckedUtilExports::::BEGIN@15MooseX::Types::CheckedUtilExports::BEGIN@15
1118µs35µsMooseX::Types::CheckedUtilExports::::BEGIN@14MooseX::Types::CheckedUtilExports::BEGIN@14
1118µs179µsMooseX::Types::CheckedUtilExports::::BEGIN@17MooseX::Types::CheckedUtilExports::BEGIN@17
1117µs16µsMooseX::Types::CheckedUtilExports::::BEGIN@11MooseX::Types::CheckedUtilExports::BEGIN@11
1117µs27µsMooseX::Types::CheckedUtilExports::::BEGIN@13MooseX::Types::CheckedUtilExports::BEGIN@13
1117µs21µsMooseX::Types::CheckedUtilExports::::BEGIN@49MooseX::Types::CheckedUtilExports::BEGIN@49
1113µs3µsMooseX::Types::CheckedUtilExports::::BEGIN@12MooseX::Types::CheckedUtilExports::BEGIN@12
112800ns800nsMooseX::Types::CheckedUtilExports::::CORE:matchMooseX::Types::CheckedUtilExports::CORE:match (opcode)
0000s0sMooseX::Types::CheckedUtilExports::::role_typeMooseX::Types::CheckedUtilExports::role_type
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1=head1 NAME
2
3MooseX::Types::CheckedUtilExports - Wrap L<Moose::Util::TypeConstraints> to be
4safer for L<MooseX::Types>
5
6=cut
7
8package MooseX::Types::CheckedUtilExports;
9
10321µs221µs
# spent 18µs (15+3) within MooseX::Types::CheckedUtilExports::BEGIN@10 which was called # once (15µs+3µs) by MooseX::Types::BEGIN@15 at line 10
use strict;
# spent 18µs making 1 call to MooseX::Types::CheckedUtilExports::BEGIN@10 # spent 3µs making 1 call to strict::import
11318µs225µs
# spent 16µs (7+9) within MooseX::Types::CheckedUtilExports::BEGIN@11 which was called # once (7µs+9µs) by MooseX::Types::BEGIN@15 at line 11
use warnings;
# spent 16µs making 1 call to MooseX::Types::CheckedUtilExports::BEGIN@11 # spent 9µs making 1 call to warnings::import
12316µs13µs
# spent 3µs within MooseX::Types::CheckedUtilExports::BEGIN@12 which was called # once (3µs+0s) by MooseX::Types::BEGIN@15 at line 12
use Moose::Util::TypeConstraints ();
# spent 3µs making 1 call to MooseX::Types::CheckedUtilExports::BEGIN@12
13321µs247µs
# spent 27µs (7+20) within MooseX::Types::CheckedUtilExports::BEGIN@13 which was called # once (7µs+20µs) by MooseX::Types::BEGIN@15 at line 13
use Moose::Exporter;
# spent 27µs making 1 call to MooseX::Types::CheckedUtilExports::BEGIN@13 # spent 20µs making 1 call to Moose::Exporter::import
14334µs262µs
# spent 35µs (8+27) within MooseX::Types::CheckedUtilExports::BEGIN@14 which was called # once (8µs+27µs) by MooseX::Types::BEGIN@15 at line 14
use Sub::Name;
# spent 35µs making 1 call to MooseX::Types::CheckedUtilExports::BEGIN@14 # spent 27µs making 1 call to Exporter::import
15334µs284µs
# spent 48µs (11+36) within MooseX::Types::CheckedUtilExports::BEGIN@15 which was called # once (11µs+36µs) by MooseX::Types::BEGIN@15 at line 15
use Carp;
# spent 48µs making 1 call to MooseX::Types::CheckedUtilExports::BEGIN@15 # spent 36µs making 1 call to Exporter::import
16
17348µs2350µs
# spent 179µs (8+171) within MooseX::Types::CheckedUtilExports::BEGIN@17 which was called # once (8µs+171µs) by MooseX::Types::BEGIN@15 at line 17
use namespace::clean -except => 'meta';
# spent 179µs making 1 call to MooseX::Types::CheckedUtilExports::BEGIN@17 # spent 171µs making 1 call to namespace::clean::import
18
191400nsmy $StringFoundMsg =
20q{WARNING: String found where Type expected (did you use a => instead of a , ?)};
21
2212µsmy @exports = qw/type subtype maybe_type duck_type enum coerce from as/;
23
24=head1 DESCRIPTION
25
26Prevents errors like:
27
28 subtype Foo =>
29 ...
30
31Which should be written as:
32
33 subtype Foo,
34 ...
35
36When using L<MooseX::Types>. Exported by that module.
37
38Exports checked versions of the following subs:
39
40C<type> C<subtype> C<maybe_type> C<duck_type> C<enum> C<coerce> C<from> C<as>
41
42While C<class_type> and C<role_type> will also register the type in the library.
43
44From L<Moose::Util::TypeConstraints>. See that module for syntax.
45
46=cut
47
481400nsfor my $export (@exports) {
493190µs235µs
# spent 21µs (7+14) within MooseX::Types::CheckedUtilExports::BEGIN@49 which was called # once (7µs+14µs) by MooseX::Types::BEGIN@15 at line 49
no strict 'refs';
# spent 21µs making 1 call to MooseX::Types::CheckedUtilExports::BEGIN@49 # spent 14µs making 1 call to strict::unimport
50
51
# spent 263µs (242+21) within MooseX::Types::CheckedUtilExports::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/MooseX/Types/CheckedUtilExports.pm:63] which was called 60 times, avg 4µs/call: # 60 times (242µs+21µs) by MooseX::Types::CheckedUtilExports::as or MooseX::Types::CheckedUtilExports::coerce or MooseX::Types::CheckedUtilExports::from or MooseX::Types::CheckedUtilExports::subtype at line 272 of Moose/Exporter.pm, avg 4µs/call
*{$export} = sub {
52240321µs my $caller = shift;
53
54 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
55
5611µs420µs carp $StringFoundMsg
# spent 10µs making 1 call to MooseX::Types::Base::get_registered_class_type # spent 10µs making 2 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:8], avg 5µs/call # spent 800ns making 1 call to MooseX::Types::CheckedUtilExports::CORE:match
57 unless ref($_[0]) ||
58 $_[0] =~ /\b::\b/ || # qualified type
59 $caller->get_registered_class_type($_[0]) ||
60 $caller->get_registered_role_type($_[0]);
61
62 goto &{"Moose::Util::TypeConstraints::$export"};
# spent 3.37ms making 10 calls to Moose::Util::TypeConstraints::coerce, avg 337µs/call # spent 3.06ms making 10 calls to Moose::Util::TypeConstraints::subtype, avg 306µs/call # spent 32µs making 30 calls to Moose::Util::TypeConstraints::from, avg 1µs/call # spent 18µs making 10 calls to Moose::Util::TypeConstraints::as, avg 2µs/call
63 }
64825µs}
65
66Moose::Exporter->setup_import_methods(
6715µs1709µs with_caller => [ @exports, 'class_type', 'role_type' ]
# spent 709µs making 1 call to Moose::Exporter::setup_import_methods
68);
69
70
# spent 506µs (17+489) within MooseX::Types::CheckedUtilExports::class_type which was called 2 times, avg 253µs/call: # once (4µs+251µs) by SimpleDB::Class::Role::Itemized::BEGIN@4 at line 98 of ../lib/SimpleDB/Class/Types.pm # once (12µs+239µs) by MooseX::Types::CheckedUtilExports::class_type at line 272 of Moose/Exporter.pm
sub class_type {
71210µs my $caller = shift;
72
73 $caller->register_class_type(
# spent 214µs making 1 call to Moose::Util::TypeConstraints::class_type # spent 24µs making 1 call to MooseX::Types::Base::register_class_type
74 Moose::Util::TypeConstraints::class_type(@_)
75 );
76}
77
78sub role_type ($;$) {
79 my ($caller, $name, $opts) = @_;
80
81 $caller->register_role_type(
82 Moose::Util::TypeConstraints::role_type($name, $opts)
83 );
84}
85
86=head1 SEE ALSO
87
88L<MooseX::Types>
89
90=head1 AUTHOR
91
92See L<MooseX::Types/AUTHOR>.
93
94=head1 LICENSE
95
96This program is free software; you can redistribute it and/or modify
97it under the same terms as perl itself.
98
99=cut
100
101119µs193µs1;
# spent 800ns within MooseX::Types::CheckedUtilExports::CORE:match which was called # once (800ns+0s) by MooseX::Types::CheckedUtilExports::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/MooseX/Types/CheckedUtilExports.pm:63] at line 56 of MooseX/Types/CheckedUtilExports.pm
sub MooseX::Types::CheckedUtilExports::CORE:match; # xsub