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 | |
by Anonymous Monk on Nov 10, 2015 at 00:23 UTC | |
by perlynewby (Scribe) on Nov 10, 2015 at 01:56 UTC |