| File | /usr/lib/perl5/vendor_perl/5.10.1/Catalyst/Action.pm |
| Statements Executed | 138 |
| Statement Execution Time | 4.48ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 13 | 4 | 2 | 839µs | 19.0s | Catalyst::Action::dispatch |
| 52 | 10 | 6 | 637µs | 637µs | Catalyst::Action::__ANON__[:44] |
| 13 | 1 | 1 | 498µs | 19.0s | Catalyst::Action::execute |
| 1 | 1 | 1 | 141µs | 273µs | Catalyst::Action::BEGIN@41 |
| 1 | 1 | 1 | 83µs | 115µs | Catalyst::Action::compare |
| 1 | 1 | 1 | 52µs | 14.7ms | Catalyst::Action::BEGIN@22 |
| 1 | 1 | 1 | 45µs | 2.11ms | Catalyst::Action::BEGIN@25 |
| 1 | 1 | 1 | 34µs | 151µs | Catalyst::Action::BEGIN@23 |
| 1 | 1 | 1 | 31µs | 85µs | Catalyst::Action::BEGIN@56 |
| 1 | 1 | 1 | 24µs | 35µs | Catalyst::Action::match |
| 0 | 0 | 0 | 0s | 0s | Catalyst::Action::__ANON__[:38] |
| 0 | 0 | 0 | 0s | 0s | Catalyst::Action::__ANON__[:47] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Catalyst::Action; | ||||
| 2 | |||||
| 3 | =head1 NAME | ||||
| 4 | |||||
| 5 | Catalyst::Action - Catalyst Action | ||||
| 6 | |||||
| 7 | =head1 SYNOPSIS | ||||
| 8 | |||||
| 9 | <form action="[%c.uri_for(c.action)%]"> | ||||
| 10 | |||||
| 11 | $c->forward( $action->private_path ); | ||||
| 12 | |||||
| 13 | =head1 DESCRIPTION | ||||
| 14 | |||||
| 15 | This class represents a Catalyst Action. You can access the object for the | ||||
| 16 | currently dispatched action via $c->action. See the L<Catalyst::Dispatcher> | ||||
| 17 | for more information on how actions are dispatched. Actions are defined in | ||||
| 18 | L<Catalyst::Controller> subclasses. | ||||
| 19 | |||||
| 20 | =cut | ||||
| 21 | |||||
| 22 | 3 | 118µs | 2 | 29.4ms | # spent 14.7ms (52µs+14.7) within Catalyst::Action::BEGIN@22 which was called
# once (52µs+14.7ms) by Catalyst::Dispatcher::BEGIN@9 at line 22 # spent 14.7ms making 1 call to Catalyst::Action::BEGIN@22
# spent 14.7ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389] |
| 23 | 3 | 115µs | 2 | 269µs | # spent 151µs (34+117) within Catalyst::Action::BEGIN@23 which was called
# once (34µs+117µs) by Catalyst::Dispatcher::BEGIN@9 at line 23 # spent 151µs making 1 call to Catalyst::Action::BEGIN@23
# spent 117µs making 1 call to Exporter::import |
| 24 | 1 | 9µs | 1 | 34.6ms | with 'MooseX::Emulate::Class::Accessor::Fast'; # spent 34.6ms making 1 call to Moose::with |
| 25 | 3 | 729µs | 2 | 4.17ms | # spent 2.11ms (45µs+2.06) within Catalyst::Action::BEGIN@25 which was called
# once (45µs+2.06ms) by Catalyst::Dispatcher::BEGIN@9 at line 25 # spent 2.11ms making 1 call to Catalyst::Action::BEGIN@25
# spent 2.06ms making 1 call to namespace::clean::import |
| 26 | |||||
| 27 | 1 | 8µs | 1 | 8.23ms | has class => (is => 'rw'); # spent 8.23ms making 1 call to Moose::has |
| 28 | 1 | 8µs | 1 | 6.25ms | has namespace => (is => 'rw'); # spent 6.25ms making 1 call to Moose::has |
| 29 | 1 | 8µs | 1 | 6.34ms | has 'reverse' => (is => 'rw'); # spent 6.34ms making 1 call to Moose::has |
| 30 | 1 | 7µs | 1 | 6.17ms | has attributes => (is => 'rw'); # spent 6.17ms making 1 call to Moose::has |
| 31 | 1 | 8µs | 1 | 6.08ms | has name => (is => 'rw'); # spent 6.08ms making 1 call to Moose::has |
| 32 | 1 | 8µs | 1 | 6.62ms | has code => (is => 'rw'); # spent 6.62ms making 1 call to Moose::has |
| 33 | has private_path => ( | ||||
| 34 | reader => 'private_path', | ||||
| 35 | isa => 'Str', | ||||
| 36 | lazy => 1, | ||||
| 37 | required => 1, | ||||
| 38 | default => sub { '/'.shift->reverse }, | ||||
| 39 | 1 | 18µs | 1 | 7.02ms | ); # spent 7.02ms making 1 call to Moose::has |
| 40 | |||||
| 41 | # spent 273µs (141+132) within Catalyst::Action::BEGIN@41 which was called
# once (141µs+132µs) by Catalyst::Dispatcher::BEGIN@9 at line 52 | ||||
| 42 | |||||
| 43 | # Stringify to reverse for debug output etc. | ||||
| 44 | 52 | 1.04ms | # spent 637µs within Catalyst::Action::__ANON__[/usr/lib/perl5/vendor_perl/5.10.1/Catalyst/Action.pm:44] which was called 52 times, avg 12µs/call:
# 15 times (92µs+0s) by Catalyst::_stats_start_execute at line 1692 of Catalyst.pm, avg 6µs/call
# 10 times (292µs+0s) by Catalyst::Dispatcher::_do_forward at line 246 of Catalyst/Dispatcher.pm, avg 29µs/call
# 9 times (76µs+0s) by Catalyst::DispatchType::Regex::list at line 58 of Catalyst/DispatchType/Regex.pm, avg 8µs/call
# 6 times (58µs+0s) by Catalyst::Dispatcher::_invoke_as_path at line 294 of Catalyst/Dispatcher.pm, avg 10µs/call
# 6 times (55µs+0s) by Catalyst::Dispatcher::_command2action at line 158 of Catalyst/Dispatcher.pm, avg 9µs/call
# 2 times (22µs+0s) by Catalyst::DispatchType::Path::list at line 59 of Catalyst/DispatchType/Path.pm, avg 11µs/call
# once (11µs+0s) by Catalyst::View::TT::process at line 208 of Catalyst/View/TT.pm
# once (11µs+0s) by Catalyst::Dispatcher::dispatch at line 105 of Catalyst/Dispatcher.pm
# once (10µs+0s) by Catalyst::Controller::_BEGIN at line 93 of Catalyst/Controller.pm
# once (9µs+0s) by Catalyst::Controller::_END at line 122 of Catalyst/Controller.pm | ||
| 45 | |||||
| 46 | # Codulate to execute to invoke the encapsulated action coderef | ||||
| 47 | '&{}' => sub { my $self = shift; sub { $self->execute(@_); }; }, | ||||
| 48 | |||||
| 49 | # Make general $stuff still work | ||||
| 50 | 1 | 78µs | 1 | 132µs | fallback => 1, # spent 132µs making 1 call to overload::import |
| 51 | |||||
| 52 | 2 | 123µs | 1 | 273µs | ); # spent 273µs making 1 call to Catalyst::Action::BEGIN@41 |
| 53 | |||||
| 54 | |||||
| 55 | |||||
| 56 | 3 | 848µs | 2 | 140µs | # spent 85µs (31+54) within Catalyst::Action::BEGIN@56 which was called
# once (31µs+54µs) by Catalyst::Dispatcher::BEGIN@9 at line 56 # spent 85µs making 1 call to Catalyst::Action::BEGIN@56
# spent 54µs making 1 call to warnings::unimport |
| 57 | |||||
| 58 | # spent 19.0s (839µs+19.0) within Catalyst::Action::dispatch which was called 13 times, avg 1.46s/call:
# 10 times (471µs+19.0s) by Catalyst::Dispatcher::_do_forward at line 257 of Catalyst/Dispatcher.pm, avg 1.90s/call
# once (26µs+-26µs) by Catalyst::Controller::_END at line 123 of Catalyst/Controller.pm
# once (205µs+-205µs) by Catalyst::Controller::_BEGIN at line 94 of Catalyst/Controller.pm
# once (137µs+-137µs) by Catalyst::Controller::_ACTION at line 110 of Catalyst/Controller.pm | ||||
| 59 | 13 | 34µs | my ( $self, $c ) = @_; | ||
| 60 | 13 | 529µs | 26 | 19.0s | return $c->execute( $self->class, $self ); # spent 75.7s making 13 calls to Catalyst::execute, avg 5.82s/call, recursion: max depth 3, time 56.7s
# spent 182µs making 13 calls to Catalyst::Action::class, avg 14µs/call |
| 61 | } | ||||
| 62 | |||||
| 63 | # spent 19.0s (498µs+19.0) within Catalyst::Action::execute which was called 13 times, avg 1.46s/call:
# 13 times (498µs+19.0s) by Catalyst::execute at line 1629 of Catalyst.pm, avg 1.46s/call | ||||
| 64 | 13 | 27µs | my $self = shift; | ||
| 65 | 13 | 533µs | 29 | 75.7s | $self->code->(@_); # spent 19.0s making 1 call to Catalyst::Controller::_DISPATCH
# spent 16.8s making 1 call to Catalyst::Controller::_END
# spent 16.8s making 1 call to Epoll::Controller::Admin::end
# spent 16.8s making 1 call to Epoll::View::TT::process
# spent 2.18s making 1 call to Catalyst::Controller::_ACTION
# spent 2.18s making 1 call to Epoll::Controller::Admin::voters
# spent 1.77s making 3 calls to Epoll::View::Mail::render, avg 589ms/call
# spent 23.5ms making 1 call to Epoll::Controller::Admin::auth
# spent 9.70ms making 1 call to Catalyst::Controller::_BEGIN
# spent 5.25ms making 1 call to Epoll::Controller::Root::begin
# spent 394µs making 1 call to Catalyst::Controller::_AUTO
# spent 317µs making 13 calls to Catalyst::Action::code, avg 24µs/call
# spent 70µs making 3 calls to Mail::Mailer::DESTROY, avg 23µs/call |
| 66 | } | ||||
| 67 | |||||
| 68 | # spent 35µs (24+11) within Catalyst::Action::match which was called
# once (24µs+11µs) by Catalyst::DispatchType::Regex::match at line 82 of Catalyst/DispatchType/Regex.pm | ||||
| 69 | 1 | 3µs | my ( $self, $c ) = @_; | ||
| 70 | #would it be unreasonable to store the number of arguments | ||||
| 71 | #the action has as its own attribute? | ||||
| 72 | #it would basically eliminate the code below. ehhh. small fish | ||||
| 73 | 1 | 19µs | 1 | 11µs | return 1 unless exists $self->attributes->{Args}; # spent 11µs making 1 call to Catalyst::Action::attributes |
| 74 | my $args = $self->attributes->{Args}[0]; | ||||
| 75 | return 1 unless defined($args) && length($args); | ||||
| 76 | return scalar( @{ $c->req->args } ) == $args; | ||||
| 77 | } | ||||
| 78 | |||||
| 79 | # spent 115µs (83+33) within Catalyst::Action::compare which was called
# once (83µs+33µs) by Catalyst::DispatchType::Path::CORE:sort at line 123 of Catalyst/DispatchType/Path.pm | ||||
| 80 | 1 | 3µs | my ($a1, $a2) = @_; | ||
| 81 | |||||
| 82 | 1 | 10µs | 1 | 8µs | my ($a1_args) = @{ $a1->attributes->{Args} || [] }; # spent 8µs making 1 call to Catalyst::Action::attributes |
| 83 | 1 | 12µs | 1 | 12µs | my ($a2_args) = @{ $a2->attributes->{Args} || [] }; # spent 12µs making 1 call to Catalyst::Action::attributes |
| 84 | |||||
| 85 | $_ = looks_like_number($_) ? $_ : ~0 | ||||
| 86 | 2 | 43µs | 2 | 12µs | for $a1_args, $a2_args; # spent 12µs making 2 calls to Scalar::Util::looks_like_number, avg 6µs/call |
| 87 | |||||
| 88 | 1 | 16µs | return $a1_args <=> $a2_args; | ||
| 89 | } | ||||
| 90 | |||||
| 91 | 1 | 17µs | 2 | 14.2ms | __PACKAGE__->meta->make_immutable; # spent 14.1ms making 1 call to Class::MOP::Class::make_immutable
# spent 107µs making 1 call to Catalyst::Action::meta |
| 92 | |||||
| 93 | 1 | 67µs | 1; | ||
| 94 | |||||
| 95 | 1 | 37µs | 1 | 2.04ms | __END__ # spent 2.04ms making 1 call to B::Hooks::EndOfScope::__ANON__[B/Hooks/EndOfScope.pm:47] |
| 96 | |||||
| 97 | =head1 METHODS | ||||
| 98 | |||||
| 99 | =head2 attributes | ||||
| 100 | |||||
| 101 | The sub attributes that are set for this action, like Local, Path, Private | ||||
| 102 | and so on. This determines how the action is dispatched to. | ||||
| 103 | |||||
| 104 | =head2 class | ||||
| 105 | |||||
| 106 | Returns the name of the component where this action is defined. | ||||
| 107 | Derived by calling the L<Catalyst::Component/catalyst_component_name|catalyst_component_name> | ||||
| 108 | method on each component. | ||||
| 109 | |||||
| 110 | =head2 code | ||||
| 111 | |||||
| 112 | Returns a code reference to this action. | ||||
| 113 | |||||
| 114 | =head2 dispatch( $c ) | ||||
| 115 | |||||
| 116 | Dispatch this action against a context. | ||||
| 117 | |||||
| 118 | =head2 execute( $controller, $c, @args ) | ||||
| 119 | |||||
| 120 | Execute this action's coderef against a given controller with a given | ||||
| 121 | context and arguments | ||||
| 122 | |||||
| 123 | =head2 match( $c ) | ||||
| 124 | |||||
| 125 | Check Args attribute, and makes sure number of args matches the setting. | ||||
| 126 | Always returns true if Args is omitted. | ||||
| 127 | |||||
| 128 | =head2 compare | ||||
| 129 | |||||
| 130 | Compares 2 actions based on the value of the C<Args> attribute, with no C<Args> | ||||
| 131 | having the highest precedence. | ||||
| 132 | |||||
| 133 | =head2 namespace | ||||
| 134 | |||||
| 135 | Returns the private namespace this action lives in. | ||||
| 136 | |||||
| 137 | =head2 reverse | ||||
| 138 | |||||
| 139 | Returns the private path for this action. | ||||
| 140 | |||||
| 141 | =head2 private_path | ||||
| 142 | |||||
| 143 | Returns absolute private path for this action. Unlike C<reverse>, the | ||||
| 144 | C<private_path> of an action is always suitable for passing to C<forward>. | ||||
| 145 | |||||
| 146 | =head2 name | ||||
| 147 | |||||
| 148 | Returns the sub name of this action. | ||||
| 149 | |||||
| 150 | =head2 meta | ||||
| 151 | |||||
| 152 | Provided by Moose. | ||||
| 153 | |||||
| 154 | =head1 AUTHORS | ||||
| 155 | |||||
| 156 | Catalyst Contributors, see Catalyst.pm | ||||
| 157 | |||||
| 158 | =head1 COPYRIGHT | ||||
| 159 | |||||
| 160 | This library is free software. You can redistribute it and/or modify it under | ||||
| 161 | the same terms as Perl itself. | ||||
| 162 | |||||
| 163 | =cut |