in reply to Return $self, but what if I don't wanna?
Generally speaking, returning $self is by no means necessary. It's a convenience, as it allows
my $d = Date->new(); $d->year(2010); $d->month(3);
to be written as
my $d = Date->new() ->year(2010) ->month(3);
In your case, _calculate_foo is only called internally and its result is discarded. There's no reason to return $self.
If you continued to have _calculate_foo return $self, you could simplify calculate_foo. But since you're likely going to use the value you calculated, why not return it instead?
|
|---|