On Mon, Mar 9, 2015 at 11:44 PM, James E Keenan <jk...@verizon.net> wrote:

> This weekend I gave my CPAN library CPAN-Mini-Visit-Simple an overhaul, a
> large part of which was guaranteeing that CPAN Testers handled the absence
> of a minicpan gracefully.  As a result, for the first time I'm getting lots
> of green on my results matrix (http://matrix.cpantesters.
> org/?dist=CPAN-Mini-Visit-Simple).
>
> Except on Windows.  See, e.g., http://www.cpantesters.org/
> cpan/report/88cc1179-8782-1014-9710-f1002b825c07, where this failure is
> reported:
>
> #####
> C:\strawberry\perl\bin\perl.exe "-MExtUtils::Command::MM"
> "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0,
> 'blib\lib', 'blib\arch')" t/*.t
>
> #   Failed test 'Got expected error message for malformed minicpan
> repository'
> #   at t/001_new.t line 78.
> #                   'Absence of C:\Users\SOLIMA~1\AppData\
> Local\Temp\FLXGKPwo7N\authors\id implies no valid minicpan at t/001_new.t
> line 74.
> # '
> #     doesn't match '(?^:Absence of C:\Users\SOLIMA~1\AppData\
> Local\Temp\FLXGKPwo7N\authors\id implies no valid minicpan)'
> # Looks like you failed 1 test of 16.
> t/001_new.t .......................
> Dubious, test returned 1 (wstat 256, 0x100)
> #####
>
> Here's the relevant source code:
>
> #####
>     my $id_dir = File::Spec->catdir($data{minicpan}, qw/authors id/);
>     croak "Absence of $id_dir implies no valid minicpan"
>         unless -d $id_dir;
>     $data{id_dir} = $id_dir;
> #####
>
> And here's the relevant testing code:
>
> #####
> {
>     my ($tdir, $id_dir, $self);
>     $tdir = tempdir();
>     $id_dir = File::Spec->catdir($tdir, qw/authors id/);
>     eval {
>         $self = CPAN::Mini::Visit::Simple->new({
>             minicpan => $tdir,
>         });
>     };
>     like($@, qr/Absence of $id_dir implies no valid minicpan/,
>         "Got expected error message for malformed minicpan repository" );
> }
> #####
>
> Note that in both cases I compose directories by File::Spec->catdir(). My
> understanding is that this should handle the Windows path separators
> issue.  So having Done The Right Thing in that respect, I can't figure out
> why I'm getting this failure.
>
> Suggestions?
>

I would guess a quotemeta (for example in the form of \Q$id_dir\E) will fix
your problem.

Leon

Reply via email to