but that is not of too much import.sub new { my ( $class, %config) = @_; # maybe check arg's bless { "_CONFIG" => \%config }, $class; }
I would have connect and disconnect warn or die when inappropriately called, i.e. connecting when already connected.
disconnect therefore would undef $self->{_DBH}.
Similiarly I would not be likely to have a connect call inside of the prepare routine. This makes the function name misleading and it just smells. There is a convenience factor but when I find my code having duplicate functionality like this it is a sign of losing track of the logical structure of the program. That I may have forgotten that connect was supposed to be called early on to setup the connection (or vice versa).
There are prettier ways to build your SQL in execute. I am not facile at building up strings of this sort--I find your SQL building to be understandable but error prone.
The continual linkage between $self and the %params might indicate that the object should be smarter. It is not possible to tell from the info you have given.
Be well, rir
In reply to Re: Comments on my code, advices how to improve it.
by rir
in thread Comments on my code, advices how to improve it.
by techcode
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |