Code that is never executed is known as dead code. Typically, the presence of dead code indicates that a logic error has occurred as a result of changes to a program or the program's environment. To improve readability and ensure that logic errors are resolved, dead code should be identified, understood, and eliminated.
...
Code Block | ||||
---|---|---|---|---|
| ||||
sub fix_name {
my $name = shift;
if ($name eq "") {
return $name;
}
$name =~ s/^([a-z])/\U$1\E/g;
$name =~ s/ ([a-z])/ \U$1\E/g;
if (length( $name) == 0) {
die "Invalid name"; # cannot happen
}
return $name;
}
|
...
Code Block | ||||
---|---|---|---|---|
| ||||
sub fix_name {
my $name = shift;
$name =~ s/^([a-z])/\U$1\E/g;
$name =~ s/ ([a-z])/ \U$1\E/g;
if (length( $name) == 0) {
die "Invalid name"; # cannot happen
}
return $name;
}
|
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
MSC00-PL | low | unlikely | high | P1 L1 | L3 |
Automated Detection
Tool | Diagnostic |
---|---|
Perl::Critic | Subroutines::ProhibitUnusedPrivateSubroutines |
Perl::Critic | ControlStructures::ProhibitUnreachableCode |
Related Guidelines
...
...
...
...
...
Automated Detection
Tool | Diagnostic |
---|---|
Perl::Critic | Subroutines::ProhibitUnusedPrivateSubroutines |
Perl::Critic | Variables::ProhibitUnreachableCode |
Bibliography
...
...
[ |
---|
...
...
...
...
...
, |
---|
...
...
|http://search.cpan.org/dist/Perl-Critic/lib/Perl/Critic/Policy/Variables/ProhibitUnreachableCode.pm]EXP30-PL. Do not use deprecated or obsolete functions 02. Expressions