in reply to Re: 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

You piqued my curiosity. I'm presuming what you meant is that they have a standard predefined set of test files to run code changes against. I see references in the code to test.csv and test.txt, but I don't see links to those files anywhere to look inside and presumably have my face twist in horror (I'm glad I was never dumb enough to try to deal with CSV files myself btw).

I have come to the conclusion that I'd like to start learning and using the Perl DBI if I can find some free time at work to do so. Not just to do the types of things I'm already doing in tab delimited files, but if I could actually talk my company's admins in to giving me direct read access to our Oracle database I feel like I could suddenly have a lot more power to do useful things. As it is, I suffer from having to output multiple flat files from our web form based database inquiry tool we pay for and then having to parse and cross reference the data in those files myself using Perl... which is why I learned and learned to love Perl in the first place actually

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
  • Comment on Re^2: Remove Tabs and Newlines Inside Fields of Text Tab Delimited Files from Excel

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

    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.

      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.

Re^3: Remove Tabs and Newlines Inside Fields of Text Tab Delimited Files from Excel
by choroba (Cardinal) on Jul 13, 2016 at 16:07 UTC
    It seems the tests either create the files themselves or contain the data in the __DATA__ section.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,