[ic] Database connection in AddDirective sub
Mathew Jones
mat at bibliopolis.com
Tue Oct 13 17:32:42 UTC 2009
Hi Everyone,
I am using AddDirective and would like to pull some data from a DB
table and store it in $Config. I am having trouble with connecting to
the database. Using the example code below, the connection always fails,
even though the table exists.
GlobalSub <<EOS
sub declare_extra_config {
package Vend::Config;
sub parse_foobar {
my ($directive,$value) = @_;
return undef unless $value =~ /yes/i;
my $db = Vend::Data::database_exists_ref('products') or
die "Couldn't get handle to table products'!";
# some more code here eventually to add data to $Config
1;
}
}
EOS
AddDirective Foobar foobar
Foobar Yes, is set at the end of my catalog.cfg file after the
Database setup section.
Any thoughts?
Regards,
Mat
More information about the interchange-users
mailing list