With the below code, with PostgreSQL, with Perl 5.005.
I wish to map Perl's 'undef' to SQL's 'NULL' but get the
warning
Use of uninitialized value at /home/rir/Rbks/Lib/Dept.pm line 26.
when passing in a hash object like:
{ dept => "somestring", descr => undef }
This is proper perl behavior but I'd like to accomplish
this without warnings.
I have about thirty similar classes with up to 60 fields.
In each I have delete/store/fetch/update functions
which will act on one or less records.
Any suggestions?
Thanks.
rir
package Dept;
@ISA = qw( RHOb DbO);
use Rbks; use RHOb; use DbO; use Carp;
# DBI stuff is inherited through Rbks.
sub store {
carp "Wrong argument count to store" unless ( @_ == 1);
my $self = shift @_;
$dbh->do( #### line 26
"insert into Dept ( dept, descr)
values ( '$self->{dept}', '$self->{descr}')"
);
}