1package TestApp::ActionRole::Shared; 2 3use Moose::Role; 4 5after execute => sub { 6 my ($self, $controller, $c) = @_; 7 8 my @current_body = $c->response->body ? 9 split(/,/, $c->response->body) : (); 10 11 push @current_body, __PACKAGE__; 12 13 $c->response->body( join(',', sort @current_body) ); 14 15 my $times_executed = $c->response->header('X-Executed-Times') || 0; 16 $c->response->header( 'X-Executed-Times' => ++$times_executed ); 17}; 18 191; 20