Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/MooseX/Storage/Basic.pm |
Statements | Executed 12 statements in 406µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.63ms | 20.3ms | BEGIN@10 | MooseX::Storage::Basic::
1 | 1 | 1 | 8µs | 8µs | BEGIN@5 | MooseX::Storage::Basic::
1 | 1 | 1 | 7µs | 79µs | BEGIN@61 | MooseX::Storage::Basic::
1 | 1 | 1 | 7µs | 97µs | BEGIN@11 | MooseX::Storage::Basic::
1 | 1 | 1 | 7µs | 1.80ms | BEGIN@8 | MooseX::Storage::Basic::
0 | 0 | 0 | 0s | 0s | _storage_construct_instance | MooseX::Storage::Basic::
0 | 0 | 0 | 0s | 0s | _storage_get_engine_class | MooseX::Storage::Basic::
0 | 0 | 0 | 0s | 0s | pack | MooseX::Storage::Basic::
0 | 0 | 0 | 0s | 0s | unpack | MooseX::Storage::Basic::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package MooseX::Storage::Basic; | ||||
2 | { | ||||
3 | 2 | 700ns | $MooseX::Storage::Basic::VERSION = '0.39'; | ||
4 | } | ||||
5 | # spent 8µs within MooseX::Storage::Basic::BEGIN@5 which was called:
# once (8µs+0s) by Module::Runtime::require_module at line 7 | ||||
6 | 1 | 4µs | $MooseX::Storage::Basic::AUTHORITY = 'cpan:STEVAN'; | ||
7 | 1 | 18µs | 1 | 8µs | } # spent 8µs making 1 call to MooseX::Storage::Basic::BEGIN@5 |
8 | 2 | 31µs | 2 | 3.59ms | # spent 1.80ms (7µs+1.79) within MooseX::Storage::Basic::BEGIN@8 which was called:
# once (7µs+1.79ms) by Module::Runtime::require_module at line 8 # spent 1.80ms making 1 call to MooseX::Storage::Basic::BEGIN@8
# spent 1.79ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519] |
9 | |||||
10 | 2 | 110µs | 1 | 20.3ms | # spent 20.3ms (1.63+18.7) within MooseX::Storage::Basic::BEGIN@10 which was called:
# once (1.63ms+18.7ms) by Module::Runtime::require_module at line 10 # spent 20.3ms making 1 call to MooseX::Storage::Basic::BEGIN@10 |
11 | 2 | 212µs | 2 | 186µs | # spent 97µs (7+90) within MooseX::Storage::Basic::BEGIN@11 which was called:
# once (7µs+90µs) by Module::Runtime::require_module at line 11 # spent 97µs making 1 call to MooseX::Storage::Basic::BEGIN@11
# spent 90µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
12 | |||||
13 | sub pack { | ||||
14 | my ( $self, %args ) = @_; | ||||
15 | my $e = $self->_storage_get_engine_class(%args)->new( object => $self ); | ||||
16 | $e->collapse_object(%args); | ||||
17 | } | ||||
18 | |||||
19 | sub unpack { | ||||
20 | my ($class, $data, %args) = @_; | ||||
21 | my $e = $class->_storage_get_engine_class(%args)->new(class => $class); | ||||
22 | |||||
23 | $class->_storage_construct_instance( | ||||
24 | $e->expand_object($data, %args), | ||||
25 | \%args | ||||
26 | ); | ||||
27 | } | ||||
28 | |||||
29 | sub _storage_get_engine_class { | ||||
30 | my ($self, %args) = @_; | ||||
31 | |||||
32 | return 'MooseX::Storage::Engine' | ||||
33 | unless ( | ||||
34 | exists $args{engine_traits} | ||||
35 | && ref($args{engine_traits}) eq 'ARRAY' | ||||
36 | && scalar(@{$args{engine_traits}}) | ||||
37 | ); | ||||
38 | |||||
39 | my @roles = String::RewritePrefix->rewrite( | ||||
40 | { | ||||
41 | '' => 'MooseX::Storage::Engine::Trait::', | ||||
42 | '+' => '', | ||||
43 | }, | ||||
44 | @{$args{engine_traits}} | ||||
45 | ); | ||||
46 | |||||
47 | Moose::Meta::Class->create_anon_class( | ||||
48 | superclasses => ['MooseX::Storage::Engine'], | ||||
49 | roles => [ @roles ], | ||||
50 | cache => 1, | ||||
51 | )->name; | ||||
52 | } | ||||
53 | |||||
54 | sub _storage_construct_instance { | ||||
55 | my ($class, $args, $opts) = @_; | ||||
56 | my %i = defined $opts->{'inject'} ? %{ $opts->{'inject'} } : (); | ||||
57 | |||||
58 | $class->new( %$args, %i ); | ||||
59 | } | ||||
60 | |||||
61 | 2 | 28µs | 2 | 151µs | # spent 79µs (7+72) within MooseX::Storage::Basic::BEGIN@61 which was called:
# once (7µs+72µs) by Module::Runtime::require_module at line 61 # spent 79µs making 1 call to MooseX::Storage::Basic::BEGIN@61
# spent 72µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:706] |
62 | |||||
63 | 1 | 3µs | 1; | ||
64 | |||||
65 | __END__ |