← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Meta/Method/Overridden.pm
StatementsExecuted 10 statements in 176µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1118µs9µsMoose::Meta::Method::Overridden::::BEGIN@4Moose::Meta::Method::Overridden::BEGIN@4
1116µs9µsMoose::Meta::Method::Overridden::::BEGIN@5Moose::Meta::Method::Overridden::BEGIN@5
1115µs88µsMoose::Meta::Method::Overridden::::BEGIN@9Moose::Meta::Method::Overridden::BEGIN@9
1115µs1.43msMoose::Meta::Method::Overridden::::BEGIN@7Moose::Meta::Method::Overridden::BEGIN@7
0000s0sMoose::Meta::Method::Overridden::::__ANON__[:39]Moose::Meta::Method::Overridden::__ANON__[:39]
0000s0sMoose::Meta::Method::Overridden::::newMoose::Meta::Method::Overridden::new
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Meta::Method::Overridden;
21400nsour $VERSION = '2.1605';
3
4213µs211µs
# spent 9µs (8+1) within Moose::Meta::Method::Overridden::BEGIN@4 which was called: # once (8µs+1µs) by Moose::Meta::Class::BEGIN@13 at line 4
use strict;
# spent 9µs making 1 call to Moose::Meta::Method::Overridden::BEGIN@4 # spent 1µs making 1 call to strict::import
5215µs212µs
# spent 9µs (6+3) within Moose::Meta::Method::Overridden::BEGIN@5 which was called: # once (6µs+3µs) by Moose::Meta::Class::BEGIN@13 at line 5
use warnings;
# spent 9µs making 1 call to Moose::Meta::Method::Overridden::BEGIN@5 # spent 3µs making 1 call to warnings::import
6
7226µs22.86ms
# spent 1.43ms (5µs+1.43) within Moose::Meta::Method::Overridden::BEGIN@7 which was called: # once (5µs+1.43ms) by Moose::Meta::Class::BEGIN@13 at line 7
use parent 'Moose::Meta::Method';
# spent 1.43ms making 1 call to Moose::Meta::Method::Overridden::BEGIN@7 # spent 1.43ms making 1 call to parent::import
8
92119µs2171µs
# spent 88µs (5+83) within Moose::Meta::Method::Overridden::BEGIN@9 which was called: # once (5µs+83µs) by Moose::Meta::Class::BEGIN@13 at line 9
use Moose::Util 'throw_exception';
# spent 88µs making 1 call to Moose::Meta::Method::Overridden::BEGIN@9 # spent 83µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
10
11sub new {
12 my ( $class, %args ) = @_;
13
14 # the package can be overridden by roles
15 # it is really more like body's compilation stash
16 # this is where we need to override the definition of super() so that the
17 # body of the code can call the right overridden version
18 my $super_package = $args{package} || $args{class}->name;
19
20 my $name = $args{name};
21
22 my $super = $args{class}->find_next_method_by_name($name);
23
24 (defined $super)
25 || throw_exception( CannotOverrideNoSuperMethod => class => $class,
26 params => \%args,
27 method_name => $name
28 );
29
30 my $super_body = $super->body;
31
32 my $method = $args{method};
33
34 my $body = sub {
35 local $Moose::SUPER_PACKAGE = $super_package;
36 local @Moose::SUPER_ARGS = @_;
37 local $Moose::SUPER_BODY = $super_body;
38 return $method->(@_);
39 };
40
41 # FIXME do we need this make sure this works for next::method?
42 # subname "${super_package}::${name}", $method;
43
44 # FIXME store additional attrs
45 $class->wrap(
46 $body,
47 package_name => $args{class}->name,
48 name => $name
49 );
50}
51
5212µs1;
53
54# ABSTRACT: A Moose Method metaclass for overridden methods
55
56__END__