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


In reply to Re: Config::Tiny croaks at runtime, not in debugger by haukex
in thread Config::Tiny croaks at runtime, not in debugger by xavier8854

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.