Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Requires CPAN distribution.

Report information
The Basics
Id: 77437
Status: open
Priority: 0/
Queue: Test-Requires

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

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



Subject: Add a way to pass arguments to import
Sometimes, you need to specify an import list or otherwise pass arguments to the module's import method. Currently, there seems to be no way to do that.
On 2012-05-26T00:03:57+01:00, DOHERTY wrote: Show quoted text
> Sometimes, you need to specify an import list or otherwise pass arguments > to the module's import method. Currently, there seems to be no way to do > that.
Personally I just do it this way: use Test::Requires "List::MoreUtils"; use Test::More; use List::MoreUtils qw(none); ok( none { $_ > 10 } qw( 1 2 3 ); ); done_testing; That is, after checking that the required module List::MoreUtils is installed, I explicitly load it. After all, it is not a documented feature that Test::Requires will load List::MoreUtils. Test::Requires just tests to see if the module *can* be loaded. (Of course, to test this, it does load it, but that's a detail of the current implementation, and could theoretically change.)
On Fri Apr 19 08:30:04 2013, TOBYINK wrote: Show quoted text
> That is, after checking that the required module List::MoreUtils is > installed, I explicitly load it.
Right, or just call the import method yourself: use Test::Requires qw(Test::Thing); Test::Thing->import(...); This won't get picked up by scan_prereqs and friends, while your "use" lines will. If you let such tools manage your dependency declarations, that could be important, because if the point is to make the test dependencies optional, then that defeats the whole purpose.