...
Although this code works correctly now, the use
statement will one day not be accepted by the Perl interpreter.
Compliant Solution
...
This compliant solution uses Universal::can()
without explicitly importing it.
Code Block | ||||
---|---|---|---|---|
| ||||
# use UNIVERSAL qw(can); # deprecated # ... rest of code sub doit { my ($func) = @_; if (can($self, $func)) { $self->$func(); } # ... } |
Risk Assessment
Using deprecated or obsolete classes or methods in program code can lead to erroneous behavior.
...