$ perl main.pl enter pg pass: foo (7/2006-11-20) DBD::Pg::st execute failed: called with 1 bind variables when 2 are needed [for Statement "SELECT param2, name, param1, description, param4, param5, data2, id, param3 FROM ppo_data WHERE id_attached=? AND date=? " with ParamValues: 1=undef, 2=undef] at /usr/share/perl5/DBIx/ContextualFetch.pm line 52, line 1. #### postgresql> CREATE TABLE "indicators" ( id SERIAL UNIQUE, name VARCHAR(20) NOT NULL, param1 VARCHAR(10), param2 VARCHAR(10), param3 VARCHAR(10), param4 VARCHAR(10), param5 VARCHAR(10), description VARCHAR(30), PRIMARY KEY (id) ); postgresql> INSERT INTO indicators VALUES (7, 'PPO', 9, 4, 2, NULL, NULL, 'PPO'); postgresql> CREATE TABLE "ppo_data" ( id_attached INTEGER, date DATE NOT NULL, data1 NUMERIC(10, 5) NOT NULL, data2 NUMERIC(10, 5), PRIMARY KEY (id_attached, date) ); postgresql> INSERT INTO ppo_data VALUES (7, '20061120', 23, 34); #### ## FOO.pm package FOO; use base 'Class::DBI'; my $username = 'hue'; my $password; my $pgdbhost = 'localhost'; my $pgdbname = 'hue'; sub get_pgdbpass { print "enter pg pass: "; ## cheap system '/bin/stty -echo'; chomp (my $pgdbpass = ); system '/bin/stty echo'; print "\n"; return $pgdbpass; } __PACKAGE__->connection ( "dbi:Pg:dbname=$pgdbname;host=$pgdbhost;", $username, $password ? $password : ($password = get_pgdbpass), {AutoCommit => 0, RaiseError => 1}, ); 1; #### ## FOO/Indicators.pm package FOO::Indicators; use base 'FOO'; __PACKAGE__->table ('indicators'); __PACKAGE__->columns ( All => qw/id name param1 param2 param3 param4 param5 description/ ); 1; #### ## FOO/Indicators/PPO.pm package FOO::Indicators::PPO; use base 'FOO::Indicators'; __PACKAGE__->table ('ppo_data'); __PACKAGE__->columns (Primary => qw/id_attached date/); __PACKAGE__->columns (Essential => qw/data1/); __PACKAGE__->columns (Others => qw/data2/); 1; #### ## main.pl use warnings; use strict; use FOO::Indicators::PPO; my $foo = FOO::Indicators::PPO->retrieve (id_attached => 7, date => '20061120'); print "foo ($foo)\n"; $foo->delete; FOO::Indicators::PPO->dbi_commit;