Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 1630
Status: resolved
Priority: 0/
Queue: Test-Prereq

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

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



Date: Tue, 8 Oct 2002 15:25:13 +1000
From: Iain Truskett <spoon [...] cpan.org>
To: bug-test-prereq [...] rt.cpan.org
Subject: Test::Prereq::Build not exporting
Bad news =) 0.10 didn't actually work. prereq_ok never actually got exported from ::Build. A straight namespace alias doesn't work due to __PACKAGE__ not being appropriate within prereq_ok(), hence the $object is blessed into the wrong class and the code looks for Makefile.PL =) Appended is a patch. It makes it work. Also included in the patch is a bit that correctly names Makefile.PL or Build.PL in an error message. cheers, -- Iain. --- Test-Prereq-0.10/lib/Build.pm Sat Oct 5 09:29:05 2002 +++ Test-Prereq-0.11/lib/Build.pm Tue Oct 8 15:22:25 2002 @@ -3,7 +3,7 @@ package Test::Prereq::Build; use strict; use base qw(Test::Prereq); -use vars qw($VERSION); +use vars qw($VERSION @EXPORT); =head1 NAME @@ -17,6 +17,7 @@ Test::Prereq::ModuleBuild - test prerequ =cut $VERSION = '0.03'; +@EXPORT = qw( prereq_ok ); use Module::Build; @@ -43,6 +44,8 @@ You can use this software under the same =cut +sub prereq_ok { __PACKAGE__->prereq_check() } + sub _master_file { 'Build.PL' } # override Module::Build --- Test-Prereq-0.10/lib/Prereq.pm Sat Oct 5 09:22:59 2002 +++ Test-Prereq-0.11/lib/Prereq.pm Tue Oct 8 15:21:43 2002 @@ -98,8 +98,12 @@ my $version = '5.006001'; sub prereq_ok { my $object = {}; - bless $object, __PACKAGE__; - + __PACKAGE__->prereq_check(); + } + +sub prereq_check + { + my $object = shift; $version = shift || '5.006001'; my $name = shift || 'Prereq test'; my $skip = shift || []; @@ -117,7 +121,7 @@ sub prereq_ok unless( $prereqs ) { $Test->ok( 0, $name ); - $Test->diag( "\tMakefile.PL did not return a true value.\n", + $Test->diag( "\t".$object->_master_file." did not return a true value.\n", "\tYou don't need to do that unless you want to use Test::Prereq,\n", "\tand apparently you do :)\n", "\t$@\n", );
[SPOON - Tue Oct 8 01:25:18 2002]: Show quoted text
> 0.10 didn't actually work. > > prereq_ok never actually got exported from ::Build.
patch applied, and import.t test added. Test-Prereq-0.11 released.