ctrager

Calling CFG.pm's dump(), getKeys() methods with no arguments

Discussion created by ctrager on Jun 15, 2012

I'm trying to understand why $cfg->dump() doesn't produce any output.

$cfg->dump($cfg) *DOES* work, but I would have thought that $cfg->dump() should work too based on just how folks usually write code and based on looking at the CFG.pm.

    

Monkeying around I found that if I change the line below from:

$self->{__PRIVATE}->{DATA} = \%hash;

to:

$self->{__PRIVATE}->{DATA} = $hash;

then $cfg->dump() works.

 

Have I stumbled on a bug in CFG.pm or no?

 

 

sub cfgopen {                  my $self = shift;         my $file = shift || die "Nimbus::CFG->cfgopen(\$file)";         my $hash = shift;         my $cfg;          if ($cfg = cfgOpen($file,1)) {              $self->{__PRIVATE}->{FILE} = $file;                          if (!defined($hash)) {                 $hash = $self;             }             $self->{__PRIVATE}->{DATA} = \%hash;              _scanSections($self,$cfg,$hash);             cfgClose($cfg);         }          return; }

Outcomes