| Filename | /home/doy/nytprof/kioku-new/accessor value (defined at /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/KiokuDB/Thunk.pm line 24) |
| Statements | Executed 2 statements in 46µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 28µs | 28µs | Eval::Closure::__ANON__[accessor value (defined at KiokuDB/Thunk.pm line 24):23] |
| 0 | 0 | 0 | 0s | 0s | Eval::Closure::__ANON__[accessor value (defined at KiokuDB/Thunk.pm line 24):22] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # spent 28µs within Eval::Closure::__ANON__[accessor value (defined at /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/KiokuDB/Thunk.pm line 24):23] which was called:
# once (28µs+0s) by Eval::Closure::_clean_eval_closure at line 94 of Eval/Closure.pm | ||||
| 2 | my $attr = ${$_[0]}; | ||||
| 3 | my $meta = ${$_[1]}; | ||||
| 4 | my $type_constraint = ${$_[2]}; | ||||
| 5 | my $type_constraint_obj = ${$_[3]}; | ||||
| 6 | #line 1 "accessor value (defined at /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/KiokuDB/Thunk.pm line 24)" | ||||
| 7 | sub { | ||||
| 8 | if (@_ > 1) { | ||||
| 9 | $meta->throw_error("Cannot assign a value to a read-only accessor", data => \@_); | ||||
| 10 | } | ||||
| 11 | if (!exists $_[0]->{"value"}) { | ||||
| 12 | my $default; | ||||
| 13 | if (my $builder = $_[0]->can($attr->builder)) { | ||||
| 14 | $default = $_[0]->$builder; | ||||
| 15 | } | ||||
| 16 | else { | ||||
| 17 | my $class = ref($_[0]) || $_[0]; | ||||
| 18 | my $builder_name = $attr->builder; | ||||
| 19 | my $attr_name = $attr->name; | ||||
| 20 | $meta->throw_error("$class does not support builder method '$builder_name' for attribute '$attr_name'"); | ||||
| 21 | } | ||||
| 22 | if (!$type_constraint->($default)) { | ||||
| 23 | 1 | 27µs | $meta->throw_error("Attribute (value) does not pass the type constraint because: " . $type_constraint_obj->get_message($default), data => $default); | ||
| 24 | 1 | 19µs | } | ||
| 25 | $_[0]->{"value"} = $default; | ||||
| 26 | } | ||||
| 27 | return $_[0]->{"value"}; | ||||
| 28 | } | ||||
| 29 | } | ||||
| 30 | ; |