in reply to PM module question/improvements

I made a valiant attempt to properly modularize this for you and explain how to continue, but my time was cut short. If nobody else does so by the time I'm awake tomorrow, I'll write you a full-blown example, using your code (with necessary modifications).

Essentially, the easiest way is to make it a real module:

> cpan install Module::Starter > module-starter --author="Your Name" --email=your_email@example.com - +-license=perl --eumm --module=Dreamcar

...then:

> cd Dreamcar > mkdir lib/Dreamcar

...then put your Dreamcar package info into lib/Dreamcar.pm, and underneath lib/Dreamcar/, put the Scuderia package in Scuderia.pm and the Da_corsa package in Da_corsa.pm. You'll need to reference them as Dreamcar::Scuderia and Dreamcar::Da_corsa.

After that, review t/00-load.t, and copy it to t/01_cars.t, and put your test cases in there.

Once done and working, you can simply run perl Makefile.PL (once), and thereafter a make test will test everything without reinstall or referencing any other locations. This makes it portable, and these are called unit tests.

Again, I'm sorry I can't elaborate right now, but it gives you something to think about until I can write up a full-blown example tomorrow (hopefully another Monk will have the time to put this together by then).

Replies are listed 'Best First'.
Re^2: PM module question/improvements
by perlynewby (Scribe) on Nov 09, 2015 at 21:44 UTC

    quick question, once I installed the module starter, it went ahead and created a Dreamcar.pm under the dir /cygdrive/c/Users/Lucca/Dreamcar/lib/. It is not empty, it has some text. Do I delete that replace it with my own pm module?

    not sure if the file it automatically created has some format in it that is required

      quick question, once I installed the module starter, it went ahead and created a Dreamcar.pm under the dir /cygdrive/c/Users/Lucca/Dreamcar/lib/

      why are you in cygwin now instead of  C:\Users\Lucca\Documents\NetBeans...?

      Do I delete that replace it with my own pm module? not sure if the file it automatically created has some format in it that is required

      Um,

      perldoc module-starter NAME module-starter - creates a skeleton module distribution ...

      This means it does a copy/paste of an example module .... you then edit/delete/cut/paste/copy/.... whatever you want or need, its regular perl modules

        cool. got it