Yes, you can call an instance method on $self in the constructor, provided you have first called bless on it (as in your example).
is it bad programming practice ?
No, it’s standard practice. See perlobj:
Once we've blessed the hash referred to by $self we can start calling methods on it. This is useful if you want to put object initialization in its own separate method:
sub new { my $class = shift; my $self = {}; bless $self, $class; $self->_initialize(); return $self; }
HTH, and welcome to the Monastery!
Athanasius <°(((>< contra mundum
In reply to Re^3: OOP method usage
by Athanasius
in thread OOP method usage
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |