Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CPAN-Reporter CPAN distribution.

Report information
The Basics
Id: 53477
Status: resolved
Priority: 0/
Queue: CPAN-Reporter

People
Owner: Nobody in particular
Requestors: stro [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.1708
Fixed in: (no value)



Subject: Having "if" in prerequisite leads to "Prerequisite version too low" error
Hi David,

When trying to build Wx, which has "if" as prerequisite, I've encountered a problem that CPAN::Reporter discards reports because of "Prerequisite version too low". It happens because CPAN::Reporter::PrereqCheck evaluates "require if;" which produces syntax error.

I downloaded 1.1709 version from GitHub and found that now there's %substitution that can be used to handle "if", but it may require listing other modules too (though I didn't find any on CPAN).

I'm attaching a patch for 1.1709, it replaces 'require Bareword::Module' with 'require "Bareword/Module.pm"', that can handle "if" and other keywords. It may be more reliable if some "not.pm" would appear on CPAN.

--
Serguei Trouchelle
Subject: PrereqCheck.pm.diff
61c61,63 < if ( ! eval "require $testmod; 1" ) { --- > my $testmodpath = $testmod . '.pm'; > $testmodpath =~ s!::!/!gx; > if ( ! eval 'require "' . $testmodpath . '"; 1' ) {
Subject: Re: [rt.cpan.org #53477] Having "if" in prerequisite leads to "Prerequisite version too low" error
Date: Thu, 7 Jan 2010 09:09:59 -0500
To: bug-CPAN-Reporter [...] rt.cpan.org
From: David Golden <xdaveg [...] gmail.com>
On Thu, Jan 7, 2010 at 8:53 AM, Serguei Trouchelle via RT <bug-CPAN-Reporter@rt.cpan.org> wrote: Show quoted text
> I'm attaching a patch for 1.1709, it replaces 'require Bareword::Module' with > 'require "Bareword/Module.pm"', that can handle "if" and other keywords. It may > be more reliable if some "not.pm" would appear on CPAN.
What do you think about doing "use $module ()" instead? I'm trying not to modify the form of the prerequisite any more than necessary. Plus there are modules like E'mail::Acme which use single-quote instead of ::. David
Subject: Re: [rt.cpan.org #53477] Having "if" in prerequisite leads to "Prerequisite version too low" error
Date: Thu, 07 Jan 2010 17:25:31 +0200
To: bug-CPAN-Reporter [...] rt.cpan.org
From: Serguei Trouchelle <stro [...] railways.dp.ua>
David Golden via RT wrote: Show quoted text
>> I'm attaching a patch for 1.1709, it replaces 'require Bareword::Module' with >> 'require "Bareword/Module.pm"', that can handle "if" and other keywords. It may >> be more reliable if some "not.pm" would appear on CPAN.
Show quoted text
> What do you think about doing "use $module ()" instead? I'm trying > not to modify the form of the prerequisite any more than necessary. > Plus there are modules like E'mail::Acme which use single-quote > instead of ::.
"use" calls "import()" that can fail for some legitimate reasons. This was my first thought too, but luckily, I was testing this on ActivePerl, which provides patched "if.pm", with the following code: my $method = shift() ? 'import' : 'unimport'; die "Too few arguments to `use if' (some code returning an empty list in list context?)" unless @_ >= 2; So 'use if;' just fails because it's called in a wrong way, while 'require "if.pm";' still works. 'use if $smth, Module 1.0' works too, so it's definitely working module, but you can't prove it with eval "use if;" I think there can be other modules with similar behavior. Quotes should be replaced with slashes too. Maybe it's better to use File::Spec->catfile() -- I'm just not sure that slashes would work on some exotic systems. -- Serguei Trouchelle
Subject: Re: [rt.cpan.org #53477] Having "if" in prerequisite leads to "Prerequisite version too low" error
Date: Thu, 7 Jan 2010 11:21:04 -0500
To: bug-CPAN-Reporter [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Thu, Jan 7, 2010 at 10:26 AM, Serguei Trouchelle via RT <bug-CPAN-Reporter@rt.cpan.org> wrote: Show quoted text
> "use" calls "import()" that can fail for some legitimate reasons.
I was proposing "use $module ()" -- with the trailing empty list that prevents import() from being called.
Subject: Re: [rt.cpan.org #53477] Having "if" in prerequisite leads to "Prerequisite version too low" error
Date: Thu, 07 Jan 2010 22:49:00 +0200
To: bug-CPAN-Reporter [...] rt.cpan.org
From: Serguei Trouchelle <stro [...] railways.dp.ua>
David Golden via RT wrote: Show quoted text
>> "use" calls "import()" that can fail for some legitimate reasons.
Show quoted text
> I was proposing "use $module ()" -- with the trailing empty list that > prevents import() from being called.
Ah, missed it. Yes, this is a good idea. -- Serguei Trouchelle