There appears to be a new pragma named parent that does roughly the same thing as base. What does parent do that warrants a new (non-core) module? I am missing something?
base tried to do one too many things – automatically handling loading modules but also allowing establishing inheritance from classes already loaded (possibly from a file whose name wasn't based on the module name). To sort of make it work, there was some hackery that caused surprising results in some cases. Rather than break backwards compatibility, a new, replacement pragma parent was introduced with cleaner semantics.
parent will be a core module as of 5.10.1.
Update: forgot that base handles fields (if you are using the fields pragma), which parent doesn't do.
Armed with the extra bit of information from ysth, I was able to see the differences in the docs:
The base pragma does the following things:
@ISA
require (unless it detects that the package has already been loaded)$VERSION does not exist in named package, base sets it to "-1, set by base.pm"
fields of the named package if they existThe parent pragma does the following things:
@ISA
require
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With