Catalyst/ActionRole/NeedsLogin.pm

filter: Statementstmt 93.7% 15 / 16 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 95.6% 22 / 23 CC 3 SCAR 7.9
CC
3
Cov
95%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« CatalystX/SimpleLogin/Form/Login.pm ↑ Summary CatalystX/SimpleLogin/TraitFor/Controller/Login/WithRedirect.pm »
1 package Catalyst::ActionRole::NeedsLogin;
2 8 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 8 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 16 ▶around execute => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
6 16 my $orig = shift;
7 16 my $self = shift;
8 16 my ($controller, $c, @args) = @_;
9  
10 16 ▶ if (!$c->user) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $c->user) { } 11 5 16
11 my $message = ($self->attributes->{LoginRedirectMessage}[0])
12 11 ▶ ? $self->attributes->{LoginRedirectMessage}[0]
Branch: 1 branch
BranchTrueFalseTotal
$self->attributes->{'LoginRedirectMessage'}[0] ? : 1 10 11
13 :'You need to login to view this page!';
14 11 $c->controller('Login')->login_redirect($c, $message, @args);
15 0 $c->detach;
16 }
17 else {
18 5 return $self->$orig(@_);
19 }
20 8 };
21  
22 8 1;
23  
24 __END__
« CatalystX/SimpleLogin/Form/Login.pm ↑ Summary CatalystX/SimpleLogin/TraitFor/Controller/Login/WithRedirect.pm »