...
Code Block | ||||
---|---|---|---|---|
| ||||
sub my_open { my ($arg1, $arg2, $arg3) = @_; print "arg1 = $arg1\n"; print "arg2 = $arg2\n"; print "arg3 = $arg3\n"; } my_open( my $input, "<", "foo.txt"); |
Exceptions
DCL31-PL-EX0: This rule does not apply to object methods. Object methods are easy for the parser to distinguish from built-in functions or keywords due to because of their distinct syntax.
Related Guidelines
CERT C++ Secure Coding Standard: DCL32-CPP. Do not declare or define a reserved identifier
CERT C Secure Coding Standard: DCL37-C. Do not declare or define a reserved identifier
Risk Assessment
Using reserved keywords can lead to unexpected program behavior and surprising results.
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL31-PL | lowLow | probableProbable | mediumMedium | P2P4 | L3 |
Automated Detection
Tool | Diagnostic |
---|---|
Perl::Critic | Subroutines::ProhibitBuiltinHomonyms |
Related Guidelines
SEI CERT C Coding Standard | DCL37-C. Do not declare or define a reserved identifier |
---|---|
SEI CERT C++ Coding Standard | DCL51-CPP. Do not declare or define a reserved identifier |
Bibliography
...
2005] |
...
"Homonyms," p. 177 | |
[CPAN] | Elliot Shank, Perl-Critic-1.116 Subroutines::ProhibitBuiltinHomonyms |
[Wall 2011] | perlfunc, perlsyn |
...