| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Util/TypeConstraints/OptimizedConstraints.pm |
| Statements | Executed 53 statements in 2.93ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 12 | 2 | 2 | 197µs | 197µs | Moose::Util::TypeConstraints::OptimizedConstraints::Str |
| 1 | 1 | 1 | 107µs | 133µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3 |
| 6 | 1 | 1 | 75µs | 75µs | Moose::Util::TypeConstraints::OptimizedConstraints::ArrayRef |
| 1 | 1 | 1 | 61µs | 158µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4 |
| 1 | 1 | 1 | 58µs | 104µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7 |
| 2 | 1 | 1 | 43µs | 80µs | Moose::Util::TypeConstraints::OptimizedConstraints::ClassName |
| 1 | 1 | 1 | 43µs | 246µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@8 |
| 1 | 1 | 1 | 37µs | 37µs | Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@6 |
| 2 | 1 | 1 | 26µs | 26µs | Moose::Util::TypeConstraints::OptimizedConstraints::CodeRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::FileHandle |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::GlobRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::HashRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Int |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Num |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Object |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Ref |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::RegexpRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Role |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::RoleName |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::ScalarRef |
| 0 | 0 | 0 | 0s | 0s | Moose::Util::TypeConstraints::OptimizedConstraints::Value |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Util::TypeConstraints::OptimizedConstraints; | ||||
| 2 | |||||
| 3 | 3 | 171µs | 2 | 160µs | # spent 133µs (107+26) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3 which was called:
# once (107µs+26µs) by Moose::Util::TypeConstraints::BEGIN@40 at line 3 # spent 133µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@3
# spent 26µs making 1 call to strict::import |
| 4 | 3 | 161µs | 2 | 255µs | # spent 158µs (61+97) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4 which was called:
# once (61µs+97µs) by Moose::Util::TypeConstraints::BEGIN@40 at line 4 # spent 158µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@4
# spent 97µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 152µs | 1 | 37µs | # spent 37µs within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@6 which was called:
# once (37µs+0s) by Moose::Util::TypeConstraints::BEGIN@40 at line 6 # spent 37µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@6 |
| 7 | 3 | 138µs | 2 | 150µs | # spent 104µs (58+46) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7 which was called:
# once (58µs+46µs) by Moose::Util::TypeConstraints::BEGIN@40 at line 7 # spent 104µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@7
# spent 46µs making 1 call to Package::DeprecationManager::__ANON__[Package/DeprecationManager.pm:61] |
| 8 | 3 | 1.72ms | 2 | 449µs | # spent 246µs (43+203) within Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@8 which was called:
# once (43µs+203µs) by Moose::Util::TypeConstraints::BEGIN@40 at line 8 # spent 246µs making 1 call to Moose::Util::TypeConstraints::OptimizedConstraints::BEGIN@8
# spent 203µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 11 | 1 | 64µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 12 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 13 | |||||
| 14 | sub Value { defined($_[0]) && !ref($_[0]) } | ||||
| 15 | |||||
| 16 | sub Ref { ref($_[0]) } | ||||
| 17 | |||||
| 18 | # We need to use a temporary here to flatten LVALUEs, for instance as in | ||||
| 19 | # Str(substr($_,0,255)). | ||||
| 20 | # spent 197µs within Moose::Util::TypeConstraints::OptimizedConstraints::Str which was called 12 times, avg 16µs/call:
# 6 times (102µs+0s) by Class::MOP::Class::__ANON__::SERIAL::11::_native_type or Class::MOP::Class::__ANON__::SERIAL::15::_native_type or Class::MOP::Class::__ANON__::SERIAL::19::_native_type or Class::MOP::Class::__ANON__::SERIAL::5::_native_type or Class::MOP::Class::__ANON__::SERIAL::8::_native_type at line 197 of accessor _native_type defined at Moose/Meta/Attribute/Native/Trait.pm, avg 17µs/call
# 6 times (95µs+0s) by Moose::Util::TypeConstraints::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Util/TypeConstraints.pm:806] at line 803 of Moose/Util/TypeConstraints.pm, avg 16µs/call | ||||
| 21 | 12 | 46µs | my $value = $_[0]; | ||
| 22 | 12 | 232µs | defined($value) && ref(\$value) eq 'SCALAR' | ||
| 23 | } | ||||
| 24 | |||||
| 25 | sub Num { !ref($_[0]) && looks_like_number($_[0]) } | ||||
| 26 | |||||
| 27 | # using a temporary here because regex matching promotes an IV to a PV, | ||||
| 28 | # and that confuses some things (like JSON.pm) | ||||
| 29 | sub Int { | ||||
| 30 | my $value = $_[0]; | ||||
| 31 | defined($value) && !ref($value) && $value =~ /^-?[0-9]+$/ | ||||
| 32 | } | ||||
| 33 | |||||
| 34 | sub ScalarRef { ref($_[0]) eq 'SCALAR' || ref($_[0]) eq 'REF' } | ||||
| 35 | 6 | 106µs | # spent 75µs within Moose::Util::TypeConstraints::OptimizedConstraints::ArrayRef which was called 6 times, avg 12µs/call:
# 6 times (75µs+0s) by Moose::Meta::TypeConstraint::ArrayRef[Str] at line 270 of Moose/Meta/TypeConstraint.pm, avg 12µs/call | ||
| 36 | sub HashRef { ref($_[0]) eq 'HASH' } | ||||
| 37 | 2 | 37µs | # spent 26µs within Moose::Util::TypeConstraints::OptimizedConstraints::CodeRef which was called 2 times, avg 13µs/call:
# 2 times (26µs+0s) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::role_generator at line 43 of accessor role_generator defined at MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm, avg 13µs/call | ||
| 38 | sub RegexpRef { ref($_[0]) eq 'Regexp' } | ||||
| 39 | sub GlobRef { ref($_[0]) eq 'GLOB' } | ||||
| 40 | |||||
| 41 | sub FileHandle { ref($_[0]) eq 'GLOB' && Scalar::Util::openhandle($_[0]) or blessed($_[0]) && $_[0]->isa("IO::Handle") } | ||||
| 42 | |||||
| 43 | sub Object { blessed($_[0]) && blessed($_[0]) ne 'Regexp' } | ||||
| 44 | |||||
| 45 | sub Role { | ||||
| 46 | Moose::Deprecated::deprecated( | ||||
| 47 | feature => 'Role type', | ||||
| 48 | message => | ||||
| 49 | 'The Role type has been deprecated. Maybe you meant to create a RoleName type?' | ||||
| 50 | ); | ||||
| 51 | blessed( $_[0] ) && $_[0]->can('does'); | ||||
| 52 | } | ||||
| 53 | |||||
| 54 | # spent 80µs (43+37) within Moose::Util::TypeConstraints::OptimizedConstraints::ClassName which was called 2 times, avg 40µs/call:
# 2 times (43µs+37µs) by Moose::Meta::TypeConstraint::check at line 115 of Moose/Meta/TypeConstraint.pm, avg 40µs/call | ||||
| 55 | 2 | 87µs | 2 | 37µs | return Class::MOP::is_class_loaded( $_[0] ); # spent 37µs making 2 calls to Class::MOP::is_class_loaded, avg 18µs/call |
| 56 | } | ||||
| 57 | |||||
| 58 | sub RoleName { | ||||
| 59 | ClassName($_[0]) | ||||
| 60 | && (Class::MOP::class_of($_[0]) || return)->isa('Moose::Meta::Role') | ||||
| 61 | } | ||||
| 62 | |||||
| 63 | # NOTE: | ||||
| 64 | # we have XS versions too, ... | ||||
| 65 | # 04:09 <@konobi> nothingmuch: konobi.co.uk/code/utilsxs.tar.gz | ||||
| 66 | # 04:09 <@konobi> or utilxs.tar.gz iirc | ||||
| 67 | |||||
| 68 | 1 | 12µs | 1; | ||
| 69 | |||||
| 70 | __END__ |