Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Despite Over time, modules in Perl can become obsolete, or superseded by newer modules.  Furthermore, despite being over 15 years old, Perl 5 continues to grow. Much of this growth comes from Perl's practice of assimilating popular CPAN modules that prove to be popularinto the core language. Modules that are not part of the core Perl language must be explicitly included to be used by a program, but modules that are part of the core language need not be. When a module has been assimilated into the core language, the original module is still available in CPAN.

Modules that have become obsolete, superseded by newer modules, or integrated into the core language are considered deprecated.  but its use is deprecated. Do not import deprecated modules. It is perfectly valid to use their features as they are now

If a module becomes deprecated because its features have been integrated into the core language, then their features may be used without importing the deprecated module.

Here is a list of CPAN modules that are deprecated:should be considered deprecated, according to Perl::Critic.

Deprecated

Class::ISA

Pod::Plainer

Shell

Switch

Universal::isa

Universal::can

Universal::VERSION

Noncompliant Code Example (Universal::can())

...

Code Block
bgColor#ffcccc
langperl

use UNIVERSAL qw(can);  # deprecated

# ...

sub doit {
  my ($func) = @_;

  if (can($self, $func)) {
    $self->$func();
  }
  # ...
}

Although While this code works correctly now, the use statement will one day not be accepted rejected by the Perl interpreter someday.

Compliant Solution

...

This compliant solution uses Universal::can() without explicitly importing it.

Code Block
bgColor#ccccff
langperl

# use UNIVERSAL qw(can);  # deprecated

# rest of code ...

sub doit {
  my ($func) = @_;

  if ($self->can($func)) {
    $self->$func();
  }
  # ...
}

Risk Assessment

Using deprecated or obsolete classes or methods in program code can lead to erroneous behavior.

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

DCL30-PL

medium Medium

likely Likely

low Low

P6 P18

L2 L1

Automated Detection

Tool Diagnostic

 Version

Checker

 Description

Perl::Critic

5.0 

Modules::ProhibitEvilModules

 

BuiltinFunctions::ProhibitUniversalCan

 

BuiltinFunctions::ProhibitUniversalIsa

 Implemented

B::lint Lint

 5.0

... is deprecated and will be removed in a future ...

 

Bibliography

...

...

...

...

,

...

...

,

...


 

...

Image Added Image Added Image Added

EXP11-C. Do not apply operators expecting one type to data of an incompatible type      03. Expressions (EXP)      EXP13-C. Treat relational and equality operators as if they were nonassociative

Wiki Markup\[[Conway 05|AA. Bibliography#Conway 05]\] pg. 114, "List Processing Side Effects" \[[Wall 2011|AA. Bibliography#Manpages]\] [perlfunc|http://perldoc.perl.org/perlfunc.html] \[[CPAN|AA. Bibliography#CPAN]\] Bar, Graham. [List::Utils|http://search.cpan.org/~gbarr/Scalar-List-Utils-1.23/lib/List/Util.pm]