Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Config::Any does not complain when Config::Tiny is not installed

by rjt (Curate)
on Oct 10, 2019 at 14:14 UTC ( #11107311=note: print w/replies, xml ) Need Help??

in reply to Config::Any does not complain when Config::Tiny is not installed

Edit: It's definitely the use of force_plugins. Without that (i.e., with plugins instead), it will indeed error out if Config::Tiny is not present:

Cannot load test.ini: required support modules are not available. Please install Config::Tiny at line 11.

The problem is on

# figure out what plugins we're using my @plugins = $force ? map { eval "require $_;"; $_; } @{ $args->{ force_plugins } +} : $class->plugins;

That map { eval "require $_;" $_ } @... line always returns @{$args->{force_plugins}}, even if one or more modules don't load. I don't know if that is the intended behavior or not (doesn't seem like it, based on my very quick reading of the docs), so it might not hurt to bring it up with the module author(s).

For now, you can work around the issue by guarding it in your own (calling) code:

@plugins = grep { eval "require $_" } @plugins;

... or raising an error if you want:

my @missing = grep { !eval "require $_" } @plugins; die "Missing plugin(s): @missing" if @missing;

Original reply missed the point a bit.

Config::Any::INI is part of the Config::Any distribution: Config::Any, and that does require Config::Tiny, which is specified under suggests in the Makefile.PL. Are you sure you don't have Config/ in your Perl install?

Replies are listed 'Best First'.
Re^2: Config::Any does not complain when Config::Tiny is not installed
by kaldor (Beadle) on Oct 10, 2019 at 19:00 UTC

    I had come to the same conclusion, with less technical details though.
    I've open a bug ticket.

    Thank you very much for your help.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11107311]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2023-03-31 02:48 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (74 votes). Check out past polls.