Git Product home page Git Product logo

cpanfile's Introduction

NAME

Module::CPANfile - Parse cpanfile

SYNOPSIS

use Module::CPANfile;

my $file = Module::CPANfile->load("cpanfile");
my $prereqs = $file->prereqs; # CPAN::Meta::Prereqs object

my @features = $file->features; # CPAN::Meta::Feature objects
my $merged_prereqs = $file->prereqs_with(@identifiers); # CPAN::Meta::Prereqs

$file->merge_meta('MYMETA.json');

DESCRIPTION

Module::CPANfile is a tool to handle cpanfile format to load application specific dependencies, not just for CPAN distributions.

METHODS

  • load

      $file = Module::CPANfile->load;
      $file = Module::CPANfile->load('cpanfile');
    

    Load and parse a cpanfile. By default it tries to load cpanfile in the current directory, unless you pass the path to its argument.

  • from_prereqs

      $file = Module::CPANfile->from_prereqs({
        runtime => { requires => { DBI => '1.000' } },
      });
    

    Creates a new Module::CPANfile object from prereqs hash you can get via CPAN::Meta's prereqs, or CPAN::Meta::Prereqs' as_string_hash.

      # read MYMETA, then feed the prereqs to create Module::CPANfile
      my $meta = CPAN::Meta->load_file('MYMETA.json');
      my $file = Module::CPANfile->from_prereqs($meta->prereqs);
    
      # load cpanfile, then recreate it with round-trip
      my $file = Module::CPANfile->load('cpanfile');
      $file = Module::CPANfile->from_prereqs($file->prereq_specs);
                                        # or $file->prereqs->as_string_hash
    
  • prereqs

    Returns CPAN::Meta::Prereqs object out of the parsed cpanfile.

  • prereq_specs

    Returns a hash reference that should be passed to CPAN::Meta::Prereqs->new.

  • features

    Returns a list of features available in the cpanfile as CPAN::Meta::Feature.

  • prereqs_with(@identifiers), effective_prereqs(\@identifiers)

    Returns CPAN::Meta::Prereqs object, with merged prereqs for features identified with the @identifiers.

  • to_string($include_empty)

      $file->to_string;
      $file->to_string(1);
    

    Returns a canonical string (code) representation for cpanfile. Useful if you want to convert CPAN::Meta::Prereqs to a new cpanfile.

      # read MYMETA's prereqs and print cpanfile representation of it
      my $meta = CPAN::Meta->load_file('MYMETA.json');
      my $file = Module::CPANfile->from_prereqs($meta->prereqs);
      print $file->to_string;
    

    By default, it omits the phase where there're no modules registered. If you pass the argument of a true value, it will print them as well.

  • save

      $file->save('cpanfile');
    

    Saves the currently loaded prereqs as a new cpanfile by calling to_string. Beware this method will overwrite the existing cpanfile without any warning or backup. Taking a backup or giving warnings to users is a caller's responsibility.

      # Read MYMETA.json and creates a new cpanfile
      my $meta = CPAN::Meta->load_file('MYMETA.json');
      my $file = Module::CPANfile->from_prereqs($meta->prereqs);
      $file->save('cpanfile');
    
  • merge_meta

      $file->merge_meta('META.yml');
      $file->merge_meta('MYMETA.json', '2.0');
    

    Merge the effective prereqs with Meta specification loaded from the given META file, using CPAN::Meta. You can specify the META spec version in the second argument, which defaults to 1.4 in case the given file is YAML, and 2 if it is JSON.

  • options_for_module

      my $options = $file->options_for_module($module);
    

    Returns the extra options specified for a given module as a hash reference. Returns undef when the given module is not specified in the cpanfile.

    For example,

      # cpanfile
      requires 'Plack', '1.000',
        dist => "MIYAGAWA/Plack-1.000.tar.gz";
    
      # ...
      my $file = Module::CPANfile->load;
      my $options = $file->options_for_module('Plack');
      # => { dist => "MIYAGAWA/Plack-1.000.tar.gz" }
    

AUTHOR

Tatsuhiko Miyagawa

SEE ALSO

cpanfile, CPAN::Meta, CPAN::Meta::Spec

cpanfile's People

Contributors

charsbar avatar dolmen avatar dsteinbrunner avatar dylanwh avatar grtodd avatar hiratara avatar jkeenan avatar ktat avatar masaki avatar mbeijen avatar miyagawa avatar oschwald avatar xdg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cpanfile's Issues

Report right error line while loading cpanfile

Parsing cpanfile failed: Not a CODE reference at /home/kes/.perlbrew/libs/perl-5.24.1@carton/lib/perl5/Module/CPANfile/Environment.pm line 76.

cpanfile example:

on configure  => {
	'Module::Build'                                   =>  0,
	'Module::Build::Pluggable'                        =>  0,
	'Module::Build::Pluggable::XSUtil'                =>  0,
	'Module::Build::Pluggable::Repository'            =>  0,
	'Module::Build::Pluggable::ReadmeMarkdownFromPod' =>  0,
};

on test => sub {
};

on build => sub {
};

on runtime => sub {
};

requires    perl =>  '5.12.0';

Generate cpanfile; why doesn't this work?

Hi. I'm trying to load my app within a known working environment in order to generate a base cpanfile. However, it's giving me errors when I attempt to install dependencies.

Here's the script I wrote to generate the cpanfile contents:

!/usr/bin/perl

use strict;

use MyApp;

use Carp;

my %modules;
foreach my $package (keys %INC) {
$package =~ s{/}{::}g;
$package =~ s/.pm$//;
my $version = eval "$package->VERSION";

$version =~ s/_.*$//g;

$modules{ $package } = $version;
}

foreach (sort keys %modules) {
my $version = $modules{$_};

print "requires '$_'";
print ", '== $version'" if $version;
print ";\n";
}

When I try to install dependencies via cpanm, I get these errors:

==> Found dependencies: IO::File, IO::Handle, Exporter::Heavy, Exporter, Data::Dumper
Found IO::File 1.14 which doesn't satisfy == 1.15.
Found Exporter::Heavy 5.66 which doesn't satisfy == 5.64.
Found Data::Dumper 2.145 which doesn't satisfy == 2.130.
! Installing the dependencies failed: Installed version (1.14) of IO::File is not in range '== 1.15', Installed version (1.28) of IO::Handle is not in range '== 1.31', Installed version (5.68) of Exporter::Heavy is not in range '== 5.64', Installed version (5.64_03) of Exporter is not in range '== 5.64', Installed version (2.130_02) of Data::Dumper is not in range '== 2.130'

Is the version I'm writing incorrect?

mymeta-cpanfile should convert optional features

If MYMETA.yml / .json have an optional_features section, it should probably be also converted and saved in the produced cpanfile.

I wrote the following hacky code which seems to work so far:

my $meta = CPAN::Meta->load_file('MYMETA.json');
my $file = Module::CPANfile->from_prereqs($meta->prereqs);

for my $feature ($meta->features) {
  $file->{_prereqs}->add_feature($feature->identifier, $feature->description);
  my $prereqs = [];
  while (my ($phase, $types) = each %{$feature->{prereqs}->{prereqs}}) {
    while (my ($type, $requirements) = each %$types) {
      my $req_spec = $requirements->as_string_hash;
      while (my ($module, $version) = each %{$req_spec}) {
        push @{$prereqs},
            Module::CPANfile::Prereq->new(
              feature => $feature->identifier,
              phase   => $phase,
              type    => $type,
              module  => $module,
              requirement => Module::CPANfile::Requirement->new(
                name    => $module,
                version => $version,
              ),
            );
      }
    }
  }
  $file->{_prereqs}->{prereqs}{$feature->identifier} = $prereqs;
}

$file->save('cpanfile');

Related: #52

Feature request: force dependency list

There are some packages in CPAN that don't have listed dependencies for example Persistent::DBI. So when "carton install" runs it tries to install first P::DBI and then P::Base the first one fails as it needs the second to be installed first. it would be cool to have something like.

dependencies 'Persistent::DBI' => [ 'Persistent::Base', '...' ];

This would solve some broken packages from cpan.

Whitespace in module name

cpanfile reads:

requires 'XML::LibXML::Simple ';

(Note the trailing space)

Run carton install:

Installing modules using ./cpanfile
Successfully installed XML-LibXML-Simple-0.93
! Installing the dependencies failed: Module 'XML::LibXML::Simple ' is not installed
! Bailing out the installation for .
1 distribution installed
Installing modules failed

This confused me for a while until I spotted the trailing space in the module name.

Is it possible to get cpanfile (or carton) to emit a helpful error message, and fail early.

Platform-specific dists

I'm not sure if this is an issue or not, but I could not find out how to define I need some modules just on some platforms?

If it's not possible, would you have an idea on how this should be implemented in the cpanfile spec?

include <cpanfile>

would be nice to have the functionality to include a cpanfile to pull some common definitions.
don't mind doing the patching if you think it makes sense.

validate 'on' phases

It should validate 'on' phases so that arbitrary names other than 'develop', 'configure', 'build' etc. can't be used.

Fails tests without '.' in @INC

On 5.25.10 with -Ddefault_inc_excludes_dot

PERL_DL_NONLAZY=1 "/home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/bin/perl5.25.10" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/author-pod-syntax.t .. skipped: these tests are for testing by the author
Can't locate t/Utils.pm in @INC (you may need to install the t::Utils module) (@INC contains: /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/feature.t line 4.
BEGIN failed--compilation aborted at t/feature.t line 4.
t/feature.t ............ 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
Can't locate t/Utils.pm in @INC (you may need to install the t::Utils module) (@INC contains: /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/parse.t line 5.
BEGIN failed--compilation aborted at t/parse.t line 5.
t/parse.t .............. 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
Can't locate t/Utils.pm in @INC (you may need to install the t::Utils module) (@INC contains: /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/merge.t line 4.
BEGIN failed--compilation aborted at t/merge.t line 4.
t/merge.t .............. 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
Can't locate t/Utils.pm in @INC (you may need to install the t::Utils module) (@INC contains: /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/requirement.t line 4.
BEGIN failed--compilation aborted at t/requirement.t line 4.
t/requirement.t ........ 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
Can't locate t/Utils.pm in @INC (you may need to install the t::Utils module) (@INC contains: /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/mirror.t line 4.
BEGIN failed--compilation aborted at t/mirror.t line 4.
t/mirror.t ............. 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
Can't locate t/Utils.pm in @INC (you may need to install the t::Utils module) (@INC contains: /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/lib /home/kent/.cpanm/work/1488176173.29222/Module-CPANfile-1.1002/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/from_prereqs.t line 5.
BEGIN failed--compilation aborted at t/from_prereqs.t line 5.
t/from_prereqs.t ....... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 

Test Summary Report
-------------------
t/feature.t          (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/parse.t            (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/merge.t            (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/requirement.t      (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/mirror.t           (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/from_prereqs.t     (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
Files=7, Tests=0,  0 wallclock secs ( 0.03 usr  0.02 sys +  0.56 cusr  0.12 csys =  0.73 CPU)
Result: FAIL
Failed 6/7 test programs. 0/0 subtests failed.

I would like to create a cpanfile that contains 'features'

I would like to create a cpanfile that contains 'features'. Module::CPANfile is able to read a cpanfile which contains features and can return them, but I can't find a way to add them.

I'm looking for something like from_prereqs but for adding a feature.

Duplicate requirements are not detected / warned / disallowed

By mistake I "require"d the same module twice, but with different versions:

on "runtime" => sub {
    require 'Time::Piece';
    # ...
    require 'Time::Piece' => '1.30';
}

To prevent unintended behaviour (in this case the second require is ignored) multiple definitions within an "on" block should at least be "warn"d, if not disallowed altogether.

feature prereqs missing in to_string output

When calling to_string on a Module::CPANfile instance that contains a feature, the generated string only contains an empty feature ... => sub {} block, with all the feature's prereqs missing.

No way to enforce ordering of required module installation

I've been poking around trying to find an example of how to do this, but I can't sort it out.

I have a Perl project that uses a cpanfile to define a list of prerequisites. One of the prerequisites is PDF::API2::Simple, which itself depends upon Module::Install.

I assumed that the requires lines in the cpanfile are processed in line-order, meaning that as long as the Module::Install line preceded the PDF::API2::Simple line, things would work correctly.

However, this is not the case - the cpanm utility appears to process the lines in random order, and so sometimes the process works but other times it doesn't.

So the question is, within a single phase, is there any way to enforce the ordering of module installations between cpanm and the cpanfile?

pin source URLs with "at" or "via"

require 'Plack', '1.0000', at => 'git://github.com/tokuhirom/Plack.git@deadbeef';

it's questionable whether it should support 'dev' option as well for search inclusion, but in most cases you should be able to specify the exact dev version such as:

require 'Plack', '1.0017'; # which is -TRIAL on CPAN

define custom source

It may make sense to add feature to define custom sources for some dependencies - like private CPAN mirror or git repository. This can be especially useful when cpanfile used for apps, not modules.

Ability to say "I always want the latest version of this dependency"

requires 'Some::Module' will install the latest version if Some::Module isn't already installed, but if it is installed it will leave it alone.

Sometimes it's Really Handy to just have the latest version all the time - quite a lot of modules come with embedded data, such as ParseUtil::Domain (which is what prompted this feature request) or my own Number::Phone, and being able to say something like requires 'Some::Module', 'latest' would enable me to force developer machines to stay up to date.

MQClient issue with MQSeries-1.34 on RHEL 8.7 with IMB MQ 9.3.0.15 and perl 5.26.3

Hi

I'd run into issues installing MQSeries-1.34 on RHEL 8.7 with IMB MQ 9.3.0.15 and perl 5.26.3. The error during 'make':

collect2: error: ld returned 1 exit status

make[1]: *** [Makefile:465: ../blib/arch/auto/MQClient/MQSeries/MQSeries.so] Error 1

make[1]: Leaving directory '/home/nsbgbdb/src/MQSeries-1.34/MQClient'

make: *** [Makefile:625: subdirs] Error 2

I applied the patch at https://rt.cpan.org/Public/Bug/Display.html?id=113894 [rt.cpan.org], and then I found a couple issues with MQSeries-1.34/MQClient/Makefile.PL:

  1. The 'my %extra_args' on line 272 is in a bad place. Because it's on line 272, it wipes-out any previous values. On line 107, there's '$extra_args{DEFINE} .= " -DRLIBS"', and that gets wiped-out due to line 272. I moved the 'my %extra_args' to line 97 or so.

  2. The code for determining the array ref index on lines 103 and 104 has a bug. This demo script shows the bug in action, and a proposed fix:

use strict;

my %Config = {

    'osname' => 'linux',

    'useithreads' => 'define',

};

# bug demo:

my $buggy_index = ($Config{osname} =~ /linux|hpux|aix/) &&

       ($Config{usethread} || $Config{usethreads} || $Config{useithreads});

print "buggy_index: $buggy_index\n";


# bug fix demo:

my $fixed_index =

    (

        $Config{osname} =~ /linux|hpux|aix/ &&

        ($Config{usethread} || $Config{usethreads} || $Config{useithreads})

    ) ? 1 : 0

;

print "fixed_index: $fixed_index\n";

Below is a diff of the file which includes the patch in https://rt.cpan.org/Public/Bug/Display.html?id=113894 [rt.cpan.org] and the 2 fixes for the issues i found. 'make' is succeeding now.

$ diff Makefile.PL,orig Makefile.PL

96a97

> my %extra_args;

103,104c104,109

<     ->[($Config{osname} =~ /linux|hpux|aix/) &&

<        ($Config{usethread} || $Config{usethreads} || $Config{useithreads})]

---

>     ->[

>         (

>             $Config{osname} =~ /linux|hpux|aix/ &&

>             ($Config{usethread} || $Config{usethreads} || $Config{useithreads})

>         ) ? 1 : 0

>     ]

194a200

>                     next if $header =~ /cmqstrc\.h/;

198d203

<

272c277

< my %extra_args;

---

>

sources

I would like to add an equivalent to gemfiles sources elements. The idea being that the sources specified would be equivalent to specifying a mirror list to cpanm. The usecase for this is where you have an internal darkpan supplying non public libraries used by your project. The cpanfile for the project can then specify the darkpan or darkpans that are required for the project. This could also be interesting in combination with stratopan.

I'd be interested to hear thoughts regarding the inclusion of an element like this, and what format/structure it should take in the cpanfile.

validate contradicting version specifications

To me this

on 'runtime' => sub {
  requires 'Foo', '== 1.1';
  requires 'Foo', '== 1.0';
};

is a contradicting version specification and processing such a cpanfile using Module::CPANfile should at least raise a warning. Unfortunately Module::CPANfile::Environment::parse() does not detect this mistake and Module::CPANfile::Prereqs::specs() implements the "last wins strategy". Any suggestion at what place more strict validation and/or a different specs selection strategy could be hooked in, is very much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.