Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Refactor method calls or not?

by dragonchild (Archbishop)
on Jan 18, 2002 at 23:29 UTC ( #139921=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://139921]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2021-04-22 22:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?