blib/lib/Tapper/Reports/Web.pm

filter: Statementstmt 97.1% 69 / 71 Branchbran 58.3% 7 / 12 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 15 / 15 Podpod n/a totaltotal 91.0% 92 / 101 CC 5 SCAR 5.6
CC
5
Cov
91%
BEGIN
4.1
__ANON__
2.0
BEGIN
1.0
CRAP 1.8
« blib/lib/Tapper/Reports/Web/Controller/Base.pm ↑ Summary blib/lib/Tapper/Reports/Web/Util/Filter/Overview.pm »
1 package Tapper::Reports::Web;
2 # git description: v5.0.16-1-g3416ed1
3  
4 12 our $AUTHORITY = 'cpan:TAPPER';
5 # ABSTRACT: Tapper - Frontend web application based on Catalyst
6 12 $Tapper::Reports::Web::VERSION = '5.0.17';
7 12 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 12 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 12 ▶use Catalyst::Runtime;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 12 extends 'Catalyst';
15 12 with 'Tapper::Reports::Web::Role::BehaviourModifications::Path';
16  
17 12 ▶use File::ShareDir ':ALL';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 12 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 12 ▶use Tapper::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 12 ▶use Log::Log4perl::Catalyst;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 12 my $hr_subconfig;
23 my $s_log4perl_config;
24  
25 12 ▶BEGIN {
Subroutine BEGIN: called CC=4 SCAR=14.0
26  
27 12 $hr_subconfig = Tapper::Config->subconfig;
28  
29 12 ▶ open my $fh_log4perl_config, '<', $hr_subconfig->{files}{log4perl_webgui_cfg} or die "Unable to open log4perl configuration '$hr_subconfig->{files}{log4perl_webgui_cfg}': $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh_log4perl_config, "<", $hr_subconfig->{"files"}{"log4perl_webgui_cfg"} or die qq[Unable to open log4perl configuration '$hr_subconfig->{"files"}{"log4perl_webgui_cfg"}': $!] 12 0 12
30 12 $s_log4perl_config = do { local $/; <$fh_log4perl_config> };
31 12 ▶ close $fh_log4perl_config or die "Unable to close log4perl configuration: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fh_log4perl_config or die "Unable to close log4perl configuration: $!" 12 0 12
32  
33 12 my ( $s_error_log_file ) = $s_log4perl_config =~ /^log4perl.appender.AppError.filename\s*=\s*(.+)$/m;
34  
35 12 ▶ use CGI::Carp qw( carpout );
Subroutine BEGIN: called CC=1 SCAR=0.0
36 12 ▶ open( my $fh_log, '>>', $s_error_log_file ) or die ( "Unable to open log file while compiling: $!\n" );
Branch: 1 branch
BranchTrueFalseTotal
open my $fh_log, ">>", $s_error_log_file or die("Unable to open log file while compiling: $!\n") 12 0 12
37 12 carpout($fh_log);
38  
39 }
40  
41 12 ▶my $root_dir = eval { dist_dir("Tapper-Reports-Web") } || getcwd."/root";
Condition50%1/2
eval { do { dist_dir('Tapper-Reports-Web') } } || getcwd() . '/root'
l!l
120
MC/DC0%0/1
eval { do { dist_dir('Tapper-Reports-Web') } } || getcwd() . '/root'
eval { do { dist_dir('Tapper-Reports-Web') } }
Truth table50%1/2
A
A= eval { do { dist_dir('Tapper-Reports-Web') } }
Aresult
11
00
42  
43 # Configure the application
44 12 __PACKAGE__->config( name => 'Tapper::Reports::Web' );
45 12 __PACKAGE__->config->{tapper_config} = $hr_subconfig;
46 12 __PACKAGE__->log(Log::Log4perl::Catalyst->new( \$s_log4perl_config ));
47  
48 # send all "die" and "warn" to Log4perl
49 54 ▶$SIG{__DIE__} = sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
50 54 ▶ if($^S) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^S) 48 6 54
51 # We're in an eval {} and don't want log
52 # this message but catch it later
53 48 return;
54 }
55 6 local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
56 6 __PACKAGE__->log->error( @_ );
57 12 };
58 3 ▶$SIG{__WARN__} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
59 3 local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
60 3 __PACKAGE__->log->warn( @_ );
61 12 };
62  
63 12 ▶use Catalyst::Engine;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 12 ▶use Catalyst::DispatchType::Regex;
Subroutine BEGIN: called CC=1 SCAR=0.0
65  
66 # Configure plugins
67 12 __PACKAGE__->config(
68 "Plugin::Static::Simple" => {
69 dirs => [ 'tapper/static' ],
70 include_path => [ $root_dir ],
71 }
72 );
73  
74 12 ▶if ( __PACKAGE__->config->{tapper_config}{web}{use_authentication} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (__PACKAGE__->config->{"tapper_config"}{"web"}{"use_authentication"}) 0 12 12
75 0 __PACKAGE__->config(
76 "Plugin::Authentication" => {
77 realms => {
78 default => {
79 credential => {
80 class => 'Authen::Simple',
81 authen => [{
82 class => 'PAM',
83 args => {
84 service => 'login'
85 }
86 }]
87 }
88 }
89 }
90 }
91 );
92 }
93 12 __PACKAGE__->config( 'Controller::HTML::FormFu' => {
94 constructor => {
95 config_file_path => [ "$root_dir/forms", 'root/forms/' ],
96 },
97 });
98  
99 12 my @plugins = qw(
100 Redirect
101 ConfigLoader
102 Static::Simple Session
103 Session::State::Cookie
104 Session::Store::File
105 );
106  
107 12 ▶if ( __PACKAGE__->config->{use_authentication} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (__PACKAGE__->config->{"use_authentication"}) 0 12 12
108 0 push @plugins, "Authentication";
109 }
110  
111 # Start the application
112 12 __PACKAGE__->setup(@plugins);
113  
114 12 1;
115  
116 __END__
« blib/lib/Tapper/Reports/Web/Controller/Base.pm ↑ Summary blib/lib/Tapper/Reports/Web/Util/Filter/Overview.pm »