Wed Jul 04 01:30:50 2012: Request 78194 was acted upon.
Transaction: Ticket created by KENO
       Queue: PAR
     Subject: PAR::Dist::parse_dist_name mis-parses par file name when arch  is
 darwin-2level
   Broken in: 0.48
    Severity: Important
       Owner: Nobody
  Requestors: k...@cpan.org
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78194 >


I am unable to load a module with arch=darwin-2level from a PAR::Repository.  
When parsing 
the par file name, PAR::Dist::parse_dist_name() counts 2level as a Perl 
version.  The test is to 
create a repository containing some module that is not otherwise available on 
the system.  I 
used Acme::Drunk.

$ cat /tmp/testpar.pl 
use strict;
use warnings;

use Test::More tests => 1;

BEGIN {
  SKIP: {
        eval{ require Acme::Drunk; 1 }
          and skip 'Acme::Drunk must not be available.';
        eval{ require PAR;
              PAR->import( {
                            repository => 'file:///tmp/repo/',
                            fallback => 0,
                           } );
              1; }
          or skip 'Could not load PAR.';
        use_ok( 'Acme::Drunk' );
    }
}
$ find /tmp/repo -name \*.par
/tmp/repo/darwin-2level/5.16.0/Acme-Drunk-0.03-darwin-2level-5.16.0.par
$ ls -l Dist.pm*
lrwxr-xr-x  1 root  wheel     12 Jul  4 00:20 Dist.pm -> Dist.pm.orig
-r--r--r--  1 root  wheel  43107 Jul  4 00:08 Dist.pm.new
-rw-r--r--  1 root  wheel  43106 Jul  4 00:09 Dist.pm.orig
$ diff Dist.pm.orig Dist.pm.new
1143c1143
<     my $version = qr/v?(?:\d+(?:_\d+)?|\d*(?:\.\d+(?:_\d+)?)+)/;
---
>     my $version = qr/v?(?:\d+(?:_\d+)?|\d*(?:\.\d+(?:_\d+)?)+)$/;
$ perl /tmp/testpar.pl 
1..1
not ok 1 - use Acme::Drunk;
#   Failed test 'use Acme::Drunk;'
#   at /tmp/testpar.pl line 17.
#     Tried to use 'Acme::Drunk'.
#     Error:  Can't locate Acme/Drunk.pm in @INC (@INC contains: 
CODE(0x10088ff00) /usr/
local/lib/perl5/site_perl/5.16.0/darwin-2level 
/usr/local/lib/perl5/site_perl/5.16.0 /usr/
local/lib/perl5/5.16.0/darwin-2level /usr/local/lib/perl5/5.16.0 . 
CODE(0x100890008)) at 
(eval 42) line 2.
# BEGIN failed--compilation aborted at (eval 42) line 2.
# Looks like you failed 1 test of 1.
$ sudo ln -sf Dist.pm.new Dist.pm
Password: 
$ perl /tmp/testpar.pl 
1..1
ok 1 - use Acme::Drunk;
$ 


The first fix that came to mind is shown above: just add '$' to the version 
regexp.  But maybe 
this is too restrictive; I have not tested on other platforms.

Reply via email to