Чтв Июн 09 05:30:24 2011, Mark@Overmeer.net писал:
Show quoted text> * Alexey Melezhik via RT (bug-CPAN-Site@rt.cpan.org) [110609 09:02]:
> > Thu Jun 09 05:02:43 2011: Request 68716 was acted upon.
> > Transaction: Ticket created by MELEZHIK
> > Queue: CPAN-Site
> > Subject: workaround for errors when parsing package versions
> >
> > sometimes one may need not to die when failed create version object
> > from parsed lines of package code, here is my workaround
>
> For modules which come from CPAN, I would not expect problems
> (my algorithm is that of Pause). But of course, it's better to
> handle the situation in case...
>
Show quoted text> Can you live with this:
>
> $_ .= shift @lines
> while m/package|use|VERSION/ && !m/\;/;
>
> if( m/^\s* package \s* ((?:\w+\:\:)*\w+) (?:\s+ (\S*))? \s* ;/x )
> { my ($thispkg, $v) = ($1, $2);
> my $thisversion;
> if($v)
> { $thisversion = eval {qv($v)};
> alert __x"illegal version for {pkg}, found '{version}':
> {err}"
> , pkg => $thispkg, version => $v, err => $@ if $@;
> }
>
> # second package in file?
>
yes, this workaround is ok, at least some packages can contain not
valid versions or even don not have them, it might be more flexible not
to die in this case but just show warning.
Show quoted text> Actually, it even triggers an error in the regression tests! But
> what I get puzzles me: when I run t/10index.t myself, i get no
> errors. However, when run with "make test", I get this
>
> t/10index.t .. 1/60 Invalid version format (dotted-decimal versions
> require at least three parts) at
> /usr/lib/perl5/site_perl/5.12.3/x86_64-linux-thread-multi/version.pm
> line 184.
> # Looks like you planned 60 tests but ran 1.
> # Looks like your test exited with 255 just after 1.
> t/10index.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
> Failed 59/60 subtests
>
> ... to make it even worse: before I did a "make clean;perl
> Makefile.PL",
> it only complained about the second test script! (Running perl
> 5.12.3)
> Any ideas?
on my environment test goes ok:
cpan[2]> look CPAN::Site
cpan CPAN-Site-1.07-QqTnsp # perl Makefile.PL
Writing Makefile for CPAN::Site
cpan CPAN-Site-1.07-QqTnsp # make
Skip blib/lib/CPAN/Site.pm (unchanged)
Skip blib/lib/CPAN/Site/Index.pm (unchanged)
cp bin/cpansite blib/script/cpansite
/usr/bin/perl5.8.8 -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/
cpansite
Manifying blib/man1/cpansite.1
cpan CPAN-Site-1.07-QqTnsp # make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/10index....ok
t/20qv.......ok
t/99pod......ok
All tests successful.
Files=3, Tests=72, 0 wallclock secs ( 0.22 cusr + 0.04 csys = 0.26
CPU)
cpan CPAN-Site-1.07-QqTnsp #
---
cpan[3]> m CPAN::Site
Module id = CPAN::Site
CPAN_USERID MARKOV (Mark Overmeer <mark@overmeer.net>)
CPAN_VERSION 1.07
CPAN_FILE M/MA/MARKOV/CPAN-Site-1.07.tar.gz
UPLOAD_DATE 2011-06-03
INST_FILE /usr/lib64/perl5/site_perl/5.8.8/CPAN/Site.pm
INST_VERSION 1.07
---
but as you can see I have another perl than yours
melezhik # perl -v
This is perl, v5.8.8 built for x86_64-linux-thread-multi
---