Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • It does require a makefile, no?

    I don't have that for my applications. A typical directory structure looks like this:

    /project
      /bin
      /lib
        /My
          Module.pm
        /The
          /Other
             Mod.pm
      /t
        My-Module.t
        The-Other-Mod.t

    The .t files contain a 'use lib "lib", "../lib";' to point to the module directory.

    Like chromatic I usually just type perl t/FILENAME to run a certain test file, but I

    • You would have one Makefile.PL with a very simple contents:
      use ExtUtils::MakeMaker;
      WriteMakefile(
          NAME => 'projectname',
          AUTHOR => 'me',
          VERSION => '1.0',
          ABSTRACT => 'this is my project',
      );
      You can change a few of those to extract better info, but you don't really need it.

      ExtUtils::MakeMaker will find all your .pm files under a lib/ directory.
  • prove is now standard with Test::Harness and Perl itself. I'd rather that people start/keep using it.
    --

    --
    xoa

    • But prove doesn't do the same thing. It doesn't call "make test", and since it has been designed not to call "make test", it very likely won't every be changed to do so by default, right?
      • I'm ignorant: why is that better?
        • Because with prove my t files have to contain "use lib 'lib';" in order to see changes in my lib directory, and that could cause odd errors if you're not very careful (overriding a blib directory that you don't expect it to do).
          • See http://use.perl.org/comments.pl?sid=24468&cid=37425 [perl.org] for the handling of this.

            And, if it doesn't do what you want, ask. :-)

            --

            --
            xoa

            • It doesn't do what I want. I want something that runs "make test".

              What if my files aren't just in lib/, but are in completely separately named directories, each with their own Makefile.PL - MakeMaker picks this up and gets everything into blib, but prove won't see them.

              See XML::Parser for an example of this.
              • OK, that's not going to work then. :-)

                The #1 reason to have prove is so that you don't have to have a Makefile or run make test at all. So in this case, it would defeat the purpose of running prove.

                Is there anything we can/should add to Test::Harness to make it more useful to you?

                --

                --
                xoa

        • Andy updated prove a while back at the request of David Wheeler and myself with an option to include the local lib directory.
          -l, --lib       Add lib to the path for your tests.
          So
          MyModule$> prove -lv t/.*t
          will run all test files in t/ with lib/ included in @INC.