in reply to abstraction - reusing OO module subs
What the two methods have in common is that they add things to lists. The lists are different. Adding things to lists is a pretty generic operation. You gain little by factoring out the list-adding code into a separate method.
What you can do is simplify. Instead of writing
write push @{$self->{column}}, @_; That reduces the amount of shared code (in lines) by 66%. Then, is it really worth creating a new method because two methods each have a single line of code that sort of looks the same? The effect would be to add lines of code, for no gain in functionality. That seems to me to be a step in the wrong direction.for (@_) { push @{$self->{column}}, $_; }
|
|---|