http://www.perlmonks.org?node_id=139931


in reply to Refactor method calls or not?

I like dragonchild's answer, but here is yet another way:
# untested sub add_company { return gen_add('company',@_); } sub add_financial_diary { return gen_add('financialDiary',@_); } sub gen_add { my ($table,$self,$data) = @_; my $return = $self->_generic_insert( $data, $table ); $self->{ _dbh }->commit if ! $self->{ _error }; return $return; }

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)