biohisham has asked for the wisdom of the Perl Monks concerning the following question:
First Thing: The book I am reading from has given me the example for Unix, to parallelize it equally on Windoze I discovered I had to download the nmake.exe and the UnxUtils, I did so, configured the EnvVariable for UnxUtils and put the nmake.exe in the Windows folder as specified.
Second thing: I created the template for this module called "Integer::Doubler" as "%h2xs -A -X -n Integer::Doubler" so far so good, It created a directory /Integer/Doubler with files and template. I ran the '%perl Makefile.pl' to get the 'Makefile', edited the "Doubler.pm" to include a subroutine and then ran '%nmake' which created me another directory called "blib" and the empty file pm_to_blib then it copied the package "Doubler.pm" to the "blib" directory with the appropriate path, so far, all the commands worked fine, the problem arises from command 'nmake test'
Third Thing: I needed to test the test file in the /t directory, my parallelization to *nux ended here, the book is giving me a different example all together, and the test file created in the /t folder uses the module 'Test::More', which I think is not the case on Linux according to the book example of a test.pl file, Anyways I added to the test file the code 'print "2 * 2 =", doubler(2);' where the doubler() is the subroutine I created in the "Doubler.pm" before doing 'nmake' as
#This is an excerpt from the automatically generated module template a +fter running % h2xs -A -X -n Integer::Doubler package Integer::Doubler; use 5.010000; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( ); our $VERSION = '0.01'; sub doubler { return 2 * shift; # I declared this sub } 1;
and from cmd I then typed nmake test, it gives me the error that:#Here is test file generated and what I added to it (Only Last Line): # Before `make install' is performed this script should be runnable wi +th # `make test'. After `make install' it should work as `perl Integer-Do +ubler.t' ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use Test::More tests => 1; BEGIN { use_ok('Integer::Doubler') }; ######################### # Insert your test code below, the Test::More module is use()ed here s +o read # its man page ( perldoc Test::More ) for help writing this test scrip +t. print "2 * 2 =", doubler(2); #<------here, line 16
"undefined subroutine &main::doubler called at t/Integer-Doubler.t lin +e 16" "#Looks like your test exited with 255 just after 1" Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully Failed Test Stat Wstat Total Fail List of Failed ---------------------------------------------------------------------- +--------- t/Integer-Doubler.t 255 65280 1 0 ?? Failed 1/1 test scripts. 0/1 subtests failed. Files=1, Tests=1, 0 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 C +PU)
I am totally blank and confused as to why it could possibly be that the subroutine doubler was not exported as part of the package and that the testing 'nmake test' was looking in the &main::doubler instead of it looking in the Doubler.pm..I hope revered monks can guide me to where my erroneousness is I exhausted my capacity and I need help, hoping that I was able to explain my problem clear enough, I'm not laying a blame on Windoze this time..
UPDATE: After making the corrections provided gracefully by ikegami the test is successful and after running 'nmake test' I get the following output
MISSION ACCOMPLISHED AND THANK YOU....Skip blib\lib\Integer\Doubler.pm (unchanged) C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness( +0, 'blib\lib', 'blib\arch')" t/*.t t/Integer-Doubler....ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 C +PU)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "nmake test" Error...
by ikegami (Patriarch) on Nov 15, 2009 at 20:15 UTC | |
|
Re: "nmake test" Error...
by Anonymous Monk on Nov 15, 2009 at 19:06 UTC |