in reply to Re^2: Remove Tabs and Newlines Inside Fields of Text Tab Delimited Files from Excel
in thread Remove Tabs and Newlines Inside Fields of Text Tab Delimited Files from Excel

Most modules on CPAN come with tests (and those which don't should). When the module is installed by the user there are four steps which should always be run on the unpacked tarball. These are:

  1. Produce the makefile or the build script
  2. Make/build the distro from the source
  3. Run the tests
  4. Install into @INC

The tests in step 3 are the ones which we're talking about here and by convention live in the top-level t/ directory. For example, here's where they are in Text::CSV_XS. You can view the results of the tests being run on a wide variety of platforms at CPAN Testers.

You can use these tests as a basis for some you run against your own code to see how it handles the various edge cases, etc.

  • Comment on Re^3: Remove Tabs and Newlines Inside Fields of Text Tab Delimited Files from Excel
  • Download Code

Replies are listed 'Best First'.
Re^4: Remove Tabs and Newlines Inside Fields of Text Tab Delimited Files from Excel
by perldigious (Priest) on Jul 13, 2016 at 16:22 UTC

    I work exclusively in Windows environments (for better or worse) and use Strawberry Perl, so I'm spoiled on the simple "cpan module_whatever" command for installs (I presume it does all those things for me?). I have on a few occasions had to go down a far more manual path involving downloading a module, creating the makefile, using "dmake", testing, and installing as you say. I'm so bad at remembering how to do it that I wrote the steps in to a bunch of tiny little scripts that I just run in order manually, though I'd guess I'll run in to something at some point where those don't work right either.

    I love it when things get difficult; after all, difficult pays the mortgage. - Dr. Keith Whites
    I hate it when things get difficult, so I'll just sell my house and rent cheap instead. - perldigious

      A bit late to this party but to answer your question, yes, both cpan and cpanm perform the build, test and install phases by default.

      As far as remembering the manual process, if it's an ExtUtils::MakeMaker based module (ie. has a Makefile.PL the process is simply:

      perl Makefile.PL dmake dmake test dmake install

      You can simply throw that into a batch script if you can't remember ;)

      Learning how to write unit tests and manually run them both individually and as a collection is one of the first things one should learn when getting serious about writing code (not just Perl, but any language). Take the time... it is time very well spent.