in reply to Re^2: For the life of me, i can't figure out this "use strict" variable problem
in thread For the life of me, i can't figure out this "use strict" variable problem

thats most likely because you cannot call $cfg->vars() if your Config::Simple object could not be created (although, the error message doesn't match to your example code).

You should check for and handle the error on the line you create the Config::Simple object (no later):
my $cfg = new Config::Simple($config_file) or die "aaarg $!";
  • Comment on Re^3: For the life of me, i can't figure out this "use strict" variable problem
  • Download Code

Replies are listed 'Best First'.
Re^4: For the life of me, i can't figure out this "use strict" variable problem
by dcasey (Novice) on Oct 24, 2004 at 21:29 UTC
    I gave both of those a try, but didn't seem to have any luck
    my $cfg = new Config::Simple($config_file) || die "ARGG!"; my %Config; eval { %Config = $cfg->vars() }; if ($0) { die "CRITICAL: $config_file is not a valid INI file!\n"; }
    ... any other ideas? Thanks a bunch BTW :-)
      ARGG! at D:\Perl-1.pl line 9, <FH> line 3.
      dies fine for me (suppling a bogus text file as config). Maybe your script dies at a later point. Maybe the problem lies in your supplied config file?

      Take a close look at your config file (line 16 as C::S suggests).
      Try to nail the problem down to the real line using the debugger or by adding checkpoint prints.
      You have made a typing error in the if statement: $0 should be $@