...
This error occurs because the BEGIN
block is evaluated at the beginning of run timeruntime, before the @ISA
statement can be evaluated. Therefore, when the Derived::new()
constructor is invoked, the Derived
class has an empty parents list , and therefore fails to invoke Base::new()
.
...
The base
module establishes the inheritence hierarchy at parse time, before any runtime code, including the BEGIN
block, is evaluated. Therefore, when the Derived::new()
constructor is invoked, Perl knows that Derived
is an instance of Base
, and the program produces the correct output:
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
OBJ30-PL | low | unlikely | low | {*}P3 | L1 |
Automated Detection
Tool | Diagnostic |
---|---|
Perl::Critic | ClassHierarchies::ProhibitExplicitISA |
...