Skip to content

Commit

Permalink
Look for blib/arch as well for FCGI.pm.
Browse files Browse the repository at this point in the history
WTF is this anyway?

    PM            => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'},
  • Loading branch information
miyagawa committed Oct 13, 2011
1 parent d9348d5 commit b11b4fb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/App/cpanminus/script.pm
Expand Up @@ -1406,20 +1406,36 @@ sub save_meta {
File::Copy::copy("MYMETA.json", "$dir/MYMETA.json");
}

my $provides = $self->_merge_hashref(
map Module::Metadata->package_versions_from_directory($_),
qw( blib/lib blib/arch ) # FCGI.pm :(
);

my $local = {
name => $module_name,
module => $module,
version => $dist->{version},
dist => $dist->{distvname},
pathname => $dist->{pathname},
provides => Module::Metadata->package_versions_from_directory("blib/lib"),
provides => $provides,
};

require JSON::PP;
open my $fh, ">", "$dir/install.json" or die $!;
print $fh JSON::PP::encode_json($local);
}

sub _merge_hashref {
my($self, @hashrefs) = @_;

my %hash;
for my $h (@hashrefs) {
%hash = (%hash, %$h);
}

return \%hash;
}

sub install_base {
my($self, $mm_opt) = @_;
$mm_opt =~ /INSTALL_BASE=(\S+)/ and return $1;
Expand Down
19 changes: 19 additions & 0 deletions xt/blib_install.t
@@ -0,0 +1,19 @@
use strict;
use Test::More;
use JSON;
use Config;
use xt::Run;

my $local_lib = "$ENV{PERL_CPANM_HOME}/perl5";
run "-L", $local_lib, "FLORA/FCGI-0.74.tar.gz";

my $file = "$local_lib/lib/perl5/$Config{archname}/.meta/FCGI-0.74/install.json";

open my $in, "<", $file or die $!;

my $data = JSON::decode_json(join "", <$in>);
is $data->{name}, "FCGI";
ok exists $data->{provides}{FCGI};

done_testing;

0 comments on commit b11b4fb

Please sign in to comment.