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


in reply to Refactor method calls or not?

If you can, put the onus on the program calling this code. You're suffering from, what it looks like, the need to explicitly say what variables you can work with. Why not just have a generic add function that validates its input?
sub generic_add { my $self = shift; my ($table, $data) = @_; return undef unless $self->is_valid_table($table); $data = $self->generic_insert($data, $table); return undef if $self->{_error}; $self->{_dbh}->commit; return $data; }

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.