in reply to abstraction - reusing OO module subs
I suppose you could write a generalized sub that utilizes either an extra parameter to name the the key/array you want to push to, or the calling sub's information available via caller. However, unless there's some important behavior in column and table that you haven't described that would end up in _put_list, I don't really see what the fuss is about. I'd recommend simply streamlining what you've got by dropping the for loop. What's wrong with push(@{$self->{table}}, @_)? This small amount of redundant code is better than a trivial subroutine.
Also, if you mean to use this in an OO manner, exporting your subroutines is not necessary. And the way they're written they expect to be called as methods, not functions.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: abstraction - reusing OO module subs
by fireartist (Chaplain) on Nov 21, 2002 at 09:57 UTC | |
by djantzen (Priest) on Nov 21, 2002 at 10:12 UTC |