Policy/Community/ModPerl.pm

filter: Statementstmt 92.8% 26 / 28 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 90.9% 10 / 11 Podpod 80.0% 4 / 5 totaltotal 85.7% 42 / 49 CC 3 SCAR 5.3
CC
3
Cov
88%
violates
3.7
default_themes
2.0
BEGIN
1.0
CRAP 1.7
« Policy/Community/WarningsSwitch.pm ↑ Summary Policy/Community/Each.pm »
1 package Perl::Critic::Policy::Community::ModPerl;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Perl::Critic::Utils qw(:severities :classification :ppi);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use parent 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = 'v1.0.4';
10  
11 1 ▶use constant DESC => 'Using mod_perl';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use constant EXPL => 'mod_perl is not designed for writing Perl web applications. Try a Plack-based framework (Web::Simple, Dancer2, Catalyst) or Mojolicious for a modern approach.';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 ▶sub supported_parameters { () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
15 8 ▶sub default_severity { $SEVERITY_HIGH }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
16 0 ▶sub default_themes { 'community' }
Subroutine default_themes: not called CC=1 SCAR=6.9
Pod documented
17 3 ▶sub applies_to { 'PPI::Statement::Include' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
18  
19 1 my %modules = (
20 'Apache' => 1,
21 'Apache::Constants' => 1,
22 'Apache::Registry' => 1,
23 'Apache::Request' => 1,
24 'Apache2::Const' => 1,
25 'Apache2::Request' => 1,
26 'ModPerl::Const' => 1,
27 'ModPerl::Registry' => 1,
28 );
29  
30 8 ▶sub violates {
Subroutine violates: called CC=3 SCAR=13.1
Pod documented
31 8 my ($self, $elem) = @_;
32 8 ▶ return $self->violation(DESC, EXPL, $elem) if exists $modules{$elem->module//''};
Branch: 1 branch
BranchTrueFalseTotal
if exists $modules{$elem->module // ""} 8 0 8
Condition50%1/2
$elem->module // ""
l!l
80
MC/DC0%0/1
$elem->module // ""
$elem->module
Truth table50%1/2
A
A= $elem->module
Aresult
11
00
33 0 return ();
34 }
35  
36 1 1;
37  
38 =head1 NAME
39  
40 Perl::Critic::Policy::Community::ModPerl - Don't use mod_perl to write web
41 applications
42  
43 =head1 DESCRIPTION
44  
45 L<mod_perl|http://perl.apache.org/> is an embedded Perl interpreter for the
46 L<Apache|http://www.apache.org/> web server. It allows you to dynamically
47 configure and mod Apache. It is not a generally good solution for writing web
48 applications. Frameworks using L<Plack> (L<Web::Simple>, L<Dancer2>,
49 L<Catalyst>) and L<Mojolicious> are much more flexible, powerful, and stable.
50 A web application written in one of these frameworks can be deployed using a
51 Perl HTTP server such as L<Starman> or L<Mojo::Server::Hypnotoad>; by proxy
52 from Apache or nginx; or even run as if they were regular CGI scripts.
53  
54 =head1 AFFILIATION
55  
56 This policy is part of L<Perl::Critic::Community>.
57  
58 =head1 CONFIGURATION
59  
60 This policy is not configurable except for the standard options.
61  
62 =head1 AUTHOR
63  
64 Dan Book, C<dbook@cpan.org>
65  
66 =head1 COPYRIGHT AND LICENSE
67  
68 Copyright 2015, Dan Book.
69  
70 This library is free software; you may redistribute it and/or modify it under
71 the terms of the Artistic License version 2.0.
72  
73 =head1 SEE ALSO
74  
75 L<Perl::Critic>
« Policy/Community/WarningsSwitch.pm ↑ Summary Policy/Community/Each.pm »