Skip to content

build failure - missing dependency #78

Description

@myrrhlin

I went to install App::jt in a local lib because I could not touch the system on the machine for tools like jq, fx, etc.
App::jt has MooX::Options as a dependency, but this module failed to build:

$ cpanm App::jt
--> Working on App::jt
Fetching http://www.cpan.org/authors/id/G/GU/GUGOD/App-jt-0.43.tar.gz ... OK
Configuring App-jt-0.43 ... OK
==> Found dependencies: JSON::Path, Hash::Flatten, Text::CSV, MooX::Options
...
Building and testing App-jt-0.43 ... OK
Successfully installed App-jt-0.43
34 distributions installed
$ jt . < applog.json
Can't locate Data/Record.pm in @INC (you may need to install the Data::Record module) (@INC contains: @{LOCALLIBS} /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18) at /usr/local/share/perl/5.18.2/Module/Runtime.pm line 314.

inserted a Carp::Always to see a call stack:

$ jt . < applog.json
Can't locate Data/Record.pm in @INC (you may need to install the Data::Record module) (@INC contains: ..) at /usr/local/share/perl/5.18.2/Module/Runtime.pm line 314.
	Module::Runtime::require_module('Data::Record') called at /usr/local/share/perl/5.18.2/Module/Runtime.pm line 345
	Module::Runtime::use_module('Data::Record') called at $LOCALLIB/MooX/Options/Role.pm line 83
	MooX::Options::Role::_options_prepare_descriptive('HASH(0x283ab90)') called at $LOCALLIB/MooX/Options/Role.pm line 337
	MooX::Options::Role::parse_options('App::jt') called at $LOCALLIB/MooX/Options/Role.pm line 277
	MooX::Options::Role::new_with_options('App::jt') called at $LOCALLIB/bin/jt line 13

and indeed

$ grep -A2 -n Data::Record $LOCALLIB/MooX/Options/Role.pm
83:                use_module("Data::Record");
84-                use_module("Regexp::Common");
85-                Regexp::Common->import;
--
88:            $has_to_split{$name} = Data::Record->new(
89-                {   split  => $data{autosplit},
90-                    unless => $Regexp::Common::RE{quoted}

but this module (and also Regexp::Common) is not listed in the %RUN_DEPS in Makefile.PL, it's listed as optional:

            runtime => {
                requires   => { %RUN_DEPS, perl => "5.8.1", },
                recommends => {
                    "Data::Record"   => 0,
                    "JSON::MaybeXS"  => 0,
                    "Regexp::Common" => 0,
                },

Given the above code, however, this is not correct. While MooX::Options can function without Data::Record (because its use_module is inside an eval), MooX::Options::Role cannot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions