Versions Compared

Key

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

...

Code Block
bgColor#ffcccc
langperl
use UNIVERSAL qw(can);  # deprecated

# ...

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

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

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

...

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

Code Block
bgColor#ccccff
langperl
# use UNIVERSAL qw(can);  # deprecated

# ... rest of code

...

Tool

Diagnostic

Perl::Critic

Modules::ProhibitEvilModules

 

BuiltinFunctions::ProhibitUniversalCan

 

BuiltinFunctions::ProhibitUniversalIsa B::lint

-w

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

...