in reply to Re: Replacing namespaces
in thread Replacing namespaces
This allows for children classes to call you as a parent and have the inheritance work. You should NEVER hardcode anything. If you have to do something like bless {}, 'First';, at least do something like bless {}, __PACKAGE__;. That way, if you change the package name, you won't forget to change the name of the package you're blessing this thingy into.sub new { my $class = shift; my $self = {}; bless $self, $class; return $self; }
The reason to declare $self first is to allow for you to populate it. :-)
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
|---|