« blib/lib/Tapper/Reports/Web/Util/Filter.pm
↑ Summary
blib/lib/Tapper/Reports/Web/Controller/Tapper/Preconditions.pm »
| 1 | package Tapper::Reports::Web::Controller::Tapper; | ||||||||||
| 2 | 13 | our $AUTHORITY = 'cpan:TAPPER'; | |||||||||
| 3 | 13 | $Tapper::Reports::Web::Controller::Tapper::VERSION = '5.0.17'; | |||||||||
| 4 | 13 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 13 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 13 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 13 | ▶ | use Tapper::Reports::Web::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 13 | ▶ | use parent 'Tapper::Reports::Web::Controller::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 3 | ▶ | sub index :Path :Args(0) | ||||||||
|
Subroutine
index: called CC=1 SCAR=0.0
| |||||||||||
| 12 | { | ||||||||||
| 13 | 3 | my ( $self, $c ) = @_; | |||||||||
| 14 | |||||||||||
| 15 | # the easy way, to avoid fiddling with Mason autohandlers on | ||||||||||
| 16 | # simple redirects | ||||||||||
| 17 | |||||||||||
| 18 | 3 | my $body = <<EOF; | |||||||||
| 19 | <html> | ||||||||||
| 20 | <head> | ||||||||||
| 21 | <meta http-equiv="refresh" content="0; URL=/tapper/start"> | ||||||||||
| 22 | <meta name="description" content="Tapper" | ||||||||||
| 23 | <title>Tapper</title> | ||||||||||
| 24 | </head> | ||||||||||
| 25 | EOF | ||||||||||
| 26 | 3 | $c->response->body($body); | |||||||||
| 27 | 13 | ▶ | } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | |||||||||||
| 30 | 21 | ▶ | sub auto :Private | ||||||||
|
Subroutine
auto: called CC=5 SCAR=24.2
Pod
documented
| |||||||||||
| 31 | { | ||||||||||
| 32 | 21 | my ( $self, $c ) = @_; | |||||||||
| 33 | 21 | my $util = Tapper::Reports::Web::Util->new(); | |||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | 21 | my (undef, $action) = split '/', $c->req->action; | |||||||||
| 37 | 21 | $c->stash->{top_menu} = $util->prepare_top_menu($action); | |||||||||
| 38 | 21 | ▶ | if ($c->config->{use_authentication}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | ▶ | if ($c->user_exists()) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | my $username = $c->user->username; | |||||||||
| 41 | 0 | foreach (@{$c->stash->{top_menu}}) { | |||||||||
| 42 | 0 | ▶ | if ($_->{text} eq 'Login') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | $_->{text} = "Logout $username"; | |||||||||
| 44 | 0 | $_->{uri} = '/tapper/user/logout'; | |||||||||
| 45 | } | ||||||||||
| 46 | } | ||||||||||
| 47 | } | ||||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | # if auto returns false the remaining actions are not called | ||||||||||
| 51 | 21 | 1; | |||||||||
| 52 | 13 | ▶ | } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 53 | |||||||||||
| 54 | |||||||||||
| 55 | 13 | 1; | |||||||||
| 56 | |||||||||||
| 57 | __END__ | ||||||||||