in reply to Makefile.PL even weirder on Windows

Huh? So you're double clicking on Makefile.PL? Don't do that.

I gotta say by the looks of Exporter-VA-1.2.2, I'd never consider testing it, much less installing it.

First, your program is pure perl, and it should follow the standard way for installing perl modules, which is not double click, which is not ./Makefile.PL, it is perl Makefile.PL, make, make test, make install.

Here's how you should think about changing it (dir structure first).

E:\NEW\EXPORTER-VA-1.2.2
|   Exporter-VA-Convert.perl
|   Makefile.PL
|   MANIFEST.txt
|   README.txt
|   VA.pm
|
\---t
        00-basic.t
        M1.pm
        M2.pm
        M3.pm
I moved all the M*.pm files to the 't' directory, and I renamed test1.perl to 00-basic.t (which i also moved to 't'), and prepended use lib 't'; to it.

I also renamed Exporter-VA.pm to VA.pm. Everything went fine, except your test file, well, ins't a perl test file (you don't have a 1..numberOfTests line). You should read this perl.com article on testing.

The simple way of testing, is to have a single test.pl in the same directory as the Makefile.PL, like so

E:\NEW\EXPORTER-VA-1.2.2
|   Exporter-VA-Convert.perl
|   Makefile.PL
|   MANIFEST.txt
|   README.txt
|   test.pl
|   VA.pm
|
\---t
        M1.pm
        M2.pm
        M3.pm

Here's the Makefile.PL

use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Exporter::VA', 'VERSION_FROM' => 'VA.pm', # finds $VERSION 'EXE_FILES' => [qw[ Exporter-VA-Convert.perl ]], 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'VA.pm', # retrieve abstract from module AUTHOR => 'A. U. Thor <a.u.thor@a.galaxy.far.far.away>') : +()), );
This is what `h2xs -AX -n Exporter::VA' basically gives you.
Writing Exporter/VA/VA.pm
Writing Exporter/VA/Makefile.PL
Writing Exporter/VA/README
Writing Exporter/VA/test.pl
Writing Exporter/VA/Changes
Writing Exporter/VA/MANIFEST
Notice where VA.pm is? If it was Exporter-VA.pm, MakeMaker would not magically rename it to Exporter\VA.pm


MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
** The Third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re: Re: Makefile.PL even weirder on Windows
by John M. Dlugosz (Monsignor) on Jan 13, 2003 at 05:01 UTC
    Another quick question:

    Moving the stuff to a t subdirectory, "nmake test" tells me that M1 etc. are not found. Apparently it does not chdir to the t directory before running the tests. How do I say in the Makefile.PL that the modules needed for the test scripts are also in that directory?

    Also, what is the significance of the name 00-basic ?

    —John

      Moving the stuff to a t subdirectory, "nmake test" tells me that M1 etc. are not found. Apparently it does not chdir to the t directory before running the tests. How do I say in the Makefile.PL that the modules needed for the test scripts are also in that directory?

      There isn't a way of doing this in the Makefile.PL that I am aware of. (Or, to be more accurate, no standard way. You can always write some custom code.)

      People normally add the directory to @INC in the appropriate *.t files.

      Also, what is the significance of the name 00-basic

      Adding a number prefix is one way to define the order test scripts are run in.

      Test are run in filename order. Some people like to have their test scripts run in a certain order. For example, you might test some basic stuff in the first script run and then bail out of the test suite if it fails - saving time when something goes wrong.

        I assume that the 1..m line applies to each file, not the whole set? The docs seem to imply the latter, but that makes things more difficult.

        Is the glob operator defined to return a list sorted by name? Ah yes, it's documented in File::Glob.

        —John

      I don't know about the number part, but MakeMaker (or whatever in the backend) globs t/*.t for test files, and runs them. Generally you wanna name these, and putting numbers don't hurt (it's like a convention).

      Remember when I say above I added use lib 't'; like to the test file (i do)? You don't do it in the makefile, you do it in your test file.


      MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
      ** The Third rule of perl club is a statement of fact: pod is sexy.

        That makes the test file sensitive to what directory its run from. Checking the current script's directory and appending a 't' would work, but is more work. Sometimes I wish the @INC paths had "same directory as the main script" option!