in reply to Config::Tiny croaks at runtime, not in debugger

Hi xavier8854,

Welcome!

What is the exact error message, including the contents of $Config::Tiny::errstr?

Also, I don't think chdir dirname($0); will be reliable in all environments, have a look at FindBin instead of trying to chdir (which may fail due to security/permission restrictions) or use $0 (which isn't always the name of the script file!). Even FindBin isn't always perfect but it tries fairly hard and has almost always worked for me.

use CGI::Carp qw/fatalsToBrowser/; use FindBin; use File::Spec::Functions qw/catfile/; use Config::Tiny; my $config = Config::Tiny->read(catfile($FindBin::Bin,'Config.ini')); croak "Failed to read Config.ini: $Config::Tiny::errstr" unless $confi +g;

Although you may want to consider the security implications of saving the config file alongside the script, and reporting the exact location of that file via the error message in case opening the file fails.

Regards,
-- Hauke D