in reply to Is this ancient perl or just a cargo cult?
If you squint just a little bit it's not that hard to move back and forth between this:
sub new { my ($class) = @_; my $this = []; bless ($this, $class); $this->[PARENT] = undef; $this->[PROGRESS] = 0; return $this; }
and this:
sub new { my ($class) = @_; my $this = {}; bless ($this, $class); $this->{PARENT} = undef; $this->{PROGRESS} = 0; return $this; }
As others have already pointed out above, there are some performance perks to using a blessed array ref instead of a hash ref, but I think many of us back then felt that a hash ref was just more "natural" for an object (can the old far.... err ... C programmers like me say "struct"? I knew you could.)
|
|---|