My new object needs some methods run during construction. How can I
do that without defining my own "new" method?
I think something like this is supposed to work:
class Geo::Ellipsoid;
has $.ellipsoid is rw = 'WGS84'; # this needs more processing
whether user-entered or default
has $.units is rw = 'radians';
# ... more attributes
# I can either us this (or submethod BUILD) # don't really yet
understand the difference
method BUILDALL {
# but how do I get access to the class's attributes to manipulate?
self.set_ellipsoid($ellipsoid);
# more methods used to initialize...
}
method set_ellipsoid($ell) {
self.ellipsoid = $ell;
# process further...
}
So, the question is: how do I get access to the class attributes and
methods inside BUILDALL (or BUILD)? Do I have to explicitly pass
values in its arg signature, including $self?
Many thanks.
Best regards,
-Tom