sub new { my $class = shift; my $device = shift; my $self = { 'device' => $device, }; bless $self, $class; $self->setInformation($device); return $self; }
There's nothing particularly magical about bless -- you can call it in the middle of the constructor with no ill effects, as long as you remember to explicitly return the object you created.
In reply to Re: calling a method within a constructor
by dirving
in thread calling a method within a constructor
by ocs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |