Profile of Moose/Meta/Method/Overridden.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For xt/tapper-mcp-scheduler-with-db-longrun.t
Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:22:35 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Meta/Method/Overridden.pm
Statements | Executed 13 statements in 256µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 11µs | 11µs | Moose::Meta::Method::Overridden::::BEGIN@2Moose::Meta::Method::Overridden::BEGIN@2
1 | 1 | 1 | 8µs | 2.59ms | Moose::Meta::Method::Overridden::::BEGIN@12Moose::Meta::Method::Overridden::BEGIN@12
1 | 1 | 1 | 7µs | 9µs | Moose::Meta::Method::Overridden::::BEGIN@9Moose::Meta::Method::Overridden::BEGIN@9
1 | 1 | 1 | 6µs | 14µs | Moose::Meta::Method::Overridden::::BEGIN@10Moose::Meta::Method::Overridden::BEGIN@10
0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Overridden::::__ANON__[:39]Moose::Meta::Method::Overridden::__ANON__[:39]
0 | 0 | 0 | 0s | 0s | Moose::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
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Moose::Meta::Method::Overridden;
2 |  |  |  |  | # spent 11µs within Moose::Meta::Method::Overridden::BEGIN@2 which was called: # once (11µs+0s) by Moose::Meta::Class::BEGIN@21 at line 4 BEGIN {
3 | 1 | 4µs |  |  | $Moose::Meta::Method::Overridden::AUTHORITY = 'cpan:STEVAN';
4 | 1 | 21µs | 1 | 11µs | } # spent 11µs making 1 call to Moose::Meta::Method::Overridden::BEGIN@2
5 |  |  |  |  | {
6 | 2 | 1µs |  |  | $Moose::Meta::Method::Overridden::VERSION = '2.0602';
7 |  |  |  |  | }
8 |  |  |  |  |
9 | 3 | 16µs | 2 | 11µs | # spent 9µs (7+2) within Moose::Meta::Method::Overridden::BEGIN@9 which was called: # once (7µs+2µs) by Moose::Meta::Class::BEGIN@21 at line 9 use strict; # spent 9µs making 1 call to Moose::Meta::Method::Overridden::BEGIN@9 # spent 2µs making 1 call to strict::import
10 | 3 | 17µs | 2 | 21µs | # spent 14µs (6+8) within Moose::Meta::Method::Overridden::BEGIN@10 which was called: # once (6µs+8µs) by Moose::Meta::Class::BEGIN@21 at line 10 use warnings; # spent 14µs making 1 call to Moose::Meta::Method::Overridden::BEGIN@10 # spent 8µs making 1 call to warnings::import
11 |  |  |  |  |
12 | 3 | 194µs | 2 | 5.16ms | # spent 2.59ms (8µs+2.58) within Moose::Meta::Method::Overridden::BEGIN@12 which was called: # once (8µs+2.58ms) by Moose::Meta::Class::BEGIN@21 at line 12 use base 'Moose::Meta::Method'; # spent 2.59ms making 1 call to Moose::Meta::Method::Overridden::BEGIN@12 # spent 2.58ms making 1 call to base::import
13 |  |  |  |  |
14 |  |  |  |  | sub new {
15 |  |  |  |  | my ( $class, %args ) = @_;
16 |  |  |  |  |
17 |  |  |  |  | # the package can be overridden by roles
18 |  |  |  |  | # it is really more like body's compilation stash
19 |  |  |  |  | # this is where we need to override the definition of super() so that the
20 |  |  |  |  | # body of the code can call the right overridden version
21 |  |  |  |  | my $super_package = $args{package} || $args{class}->name;
22 |  |  |  |  |
23 |  |  |  |  | my $name = $args{name};
24 |  |  |  |  |
25 |  |  |  |  | my $super = $args{class}->find_next_method_by_name($name);
26 |  |  |  |  |
27 |  |  |  |  | (defined $super)
28 |  |  |  |  | || $class->throw_error("You cannot override '$name' because it has no super method", data => $name);
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 |  |  |  |  |
52 | 1 | 3µs |  |  | 1;
53 |  |  |  |  |
54 |  |  |  |  | # ABSTRACT: A Moose Method metaclass for overridden methods
55 |  |  |  |  |
- - |  |  |  |  |
58 |  |  |  |  | =pod
59 |  |  |  |  |
60 |  |  |  |  | =head1 NAME
61 |  |  |  |  |
62 |  |  |  |  | Moose::Meta::Method::Overridden - A Moose Method metaclass for overridden methods
63 |  |  |  |  |
64 |  |  |  |  | =head1 VERSION
65 |  |  |  |  |
66 |  |  |  |  | version 2.0602
67 |  |  |  |  |
68 |  |  |  |  | =head1 DESCRIPTION
69 |  |  |  |  |
70 |  |  |  |  | This class implements method overriding logic for the L<Moose>
71 |  |  |  |  | C<override> keyword.
72 |  |  |  |  |
73 |  |  |  |  | The overriding subroutine's parent will be invoked explicitly using
74 |  |  |  |  | the C<super> keyword from the parent class's method definition.
75 |  |  |  |  |
76 |  |  |  |  | =head1 METHODS
77 |  |  |  |  |
78 |  |  |  |  | =over 4
79 |  |  |  |  |
80 |  |  |  |  | =item B<< Moose::Meta::Method::Overridden->new(%options) >>
81 |  |  |  |  |
82 |  |  |  |  | This constructs a new object. It accepts the following options:
83 |  |  |  |  |
84 |  |  |  |  | =over 8
85 |  |  |  |  |
86 |  |  |  |  | =item * class
87 |  |  |  |  |
88 |  |  |  |  | The metaclass object for the class in which the override is being
89 |  |  |  |  | declared. This option is required.
90 |  |  |  |  |
91 |  |  |  |  | =item * name
92 |  |  |  |  |
93 |  |  |  |  | The name of the method which we are overriding. This method must exist
94 |  |  |  |  | in one of the class's superclasses. This option is required.
95 |  |  |  |  |
96 |  |  |  |  | =item * method
97 |  |  |  |  |
98 |  |  |  |  | The subroutine reference which implements the overriding. This option
99 |  |  |  |  | is required.
100 |  |  |  |  |
101 |  |  |  |  | =back
102 |  |  |  |  |
103 |  |  |  |  | =back
104 |  |  |  |  |
105 |  |  |  |  | =head1 BUGS
106 |  |  |  |  |
107 |  |  |  |  | See L<Moose/BUGS> for details on reporting bugs.
108 |  |  |  |  |
109 |  |  |  |  | =head1 AUTHOR
110 |  |  |  |  |
111 |  |  |  |  | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
112 |  |  |  |  |
113 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
114 |  |  |  |  |
115 |  |  |  |  | This software is copyright (c) 2012 by Infinity Interactive, Inc..
116 |  |  |  |  |
117 |  |  |  |  | This is free software; you can redistribute it and/or modify it under
118 |  |  |  |  | the same terms as the Perl 5 programming language system itself.
119 |  |  |  |  |
120 |  |  |  |  | =cut
121 |  |  |  |  |
122 |  |  |  |  |
123 |  |  |  |  | __END__