[rt.cpan.org #109110] Incompatible with Module::ScanDeps 1.20

[email protected] ("Neubauer, Ralf via RT")
Newsgroups perl.par
Message-ID <[email protected]>
Wed Nov 18 08:49:08 2015: Request 109110 was acted upon.
Transaction: Ticket created by [email protected]
       Queue: PAR-Packer
     Subject: Incompatible with Module::ScanDeps 1.20
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=109110 >


Using pp results in:

Can't use string ("1") as an ARRAY ref while "strict refs" in use at c:/strawberry-5.22.0.1-32/perl/site/lib/Module/ScanDeps.pm line 1085.

This code in PAR-Packer-1.026:

        my $preload = Module::ScanDeps::_get_preload($module) or next;

        $add_deps->(
            used_by => $file,
            rv      => \%map,
            modules => $preload,
            skip    => \%skip,
#            warn_missing => $args->{warn_missing},
        );
        push @files, map {&$inc_find($_)} @$preload;

is incompatible with the change in Module:ScanDeps between version 1.19 and 1.20:

1.19:
sub _get_preload {
    my $pm = shift;
    my $preload = $Preload{$pm} or return();
    if ($preload eq 'sub') {
        $pm =~ s/\.p[mh]$//i;
        $preload = [ _glob_in_inc($pm, 1) ];
    }
    elsif (UNIVERSAL::isa($preload, 'CODE')) {
        $preload = [ $preload->($pm) ];
    }
    return $preload;
}

1.20:
sub _get_preload {
    my ($pm, $seen) = @_;
    $seen ||= {};
    $seen->{$pm}++;
    my @preload;

    foreach $pm (_get_preload1($pm))
    {
        next if $seen->{$pm};
        $seen->{$pm}++;
        push @preload, $pm, _get_preload($pm, $seen);
    }
    return @preload;
}

Changing the above code to

        my @preload = Module::ScanDeps::_get_preload($module) or next;
        
        $add_deps->(
            used_by => $file,
            rv      => \%map,
            modules => \@preload,
            skip    => \%skip,
#            warn_missing => $args->{warn_missing},
        );
        push @files, map {&$inc_find($_)} @preload;

seems to help, but of course needs Module-ScanDeps-1.20 .

Ralf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.