| Filename | /home/doy/nytprof/markdent/accessor _native_type defined at /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Attribute/Native/Trait.pm |
| Statements | Executed 113 statements in 1.36ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Generated::__ANON__[accessor _native_type defined at Moose/Meta/Attribute/Native/Trait.pm:200] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | my $type_constraint = ${$__captures->{'$type_constraint'}}; | ||||
| 2 | my $type_constraint_obj = ${$__captures->{'$type_constraint_obj'}}; | ||||
| 3 | my $meta = ${$__captures->{'$meta'}}; | ||||
| 4 | my $attr = ${$__captures->{'$attr'}}; | ||||
| 5 | #line 190 "accessor _native_type defined at /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Attribute/Native/Trait.pm" | ||||
| 6 | sub {$meta->throw_error("Cannot assign a value to a read-only accessor", data => \@_) if @_ > 1;unless (exists $_[0]->{"_native_type"}) { | ||||
| 7 | my $default; | ||||
| 8 | if(my $builder = $_[0]->can($attr->builder)){ | ||||
| 9 | $default = $_[0]->$builder; | ||||
| 10 | } else { | ||||
| 11 | $meta->throw_error(sprintf "%s does not support builder method '%s' for attribute '%s'", ref($_[0]) || $_[0], $attr->builder, $attr->name); | ||||
| 12 | } | ||||
| 13 | $type_constraint->($default) || $meta->throw_error("Attribute (_native_type) does not pass the type constraint because: " . $type_constraint_obj->get_message($default), data => $default); | ||||
| 14 | $_[0]->{"_native_type"} = $default; | ||||
| 15 | } | ||||
| 16 | return $_[0]->{"_native_type"};} | ||||
| 17 | ; | ||||
| 18 | |||||
| - - | |||||
| 190 | 108 | 1.20ms | |||
| - - | |||||
| 192 | 18 | 3.07ms | # spent 2.96ms making 6 calls to Moose::Meta::Attribute::Native::Trait::_build_native_type, avg 493µs/call
# spent 69µs making 6 calls to Class::MOP::Mixin::AttributeCore::builder, avg 11µs/call
# spent 46µs making 6 calls to UNIVERSAL::can, avg 8µs/call | ||
| - - | |||||
| 197 | 6 | 102µs | # spent 102µs making 6 calls to Moose::Util::TypeConstraints::OptimizedConstraints::Str, avg 17µs/call | ||
| - - | |||||
| 201 | 5 | 156µs |