Problem with exported Variables

[prev] [thread] [next] [Date index for 2004/05/18]

From: cegner
Subject: Problem with exported Variables
Date: 20:52 on 18 May 2004
Hello,

I'm having a problem with exported variables from other packages that seem to be ignored/not imported.

At first, two code snippets.

This class is for sharing default values and configuration parameters between a couple of classes:

use CMDB::Config;
use Config::Vars qw(exportall);
var %CONFIG = (
    # MySQL Database
    db_host => 'localhost',
    db_name => 'bla',
    db_user => 'root',
    db_pass => '',
    db_port => 3306,
);


The following class is for setup of Class::DBI with database connection information:

package CMDB::Backend::Tables;
use base 'Class::DBI';
use CMDB::Config;

CMDB::Backend::Tables->connection("DBI:mysql:$CONFIG{db_name}:$CONFIG{db_host}:$CONFIG{db_port}", $CONFIG{db_user}, $CONFIG{db_pass}); 

My problem is, that "use CMDB::Config;" seems to be ignored; the variable %CONFIG which is exported from there seems not to be imported.
I didn't have any problems yet importing it from other classes.

Is this problem related to Class::DBI?

Best Regards,
Christof

Problem with exported Variables
cegner 20:52 on 18 May 2004

Re: Problem with exported Variables
colm-cdbi 21:25 on 19 May 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52