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).
In reply to Re: PM module question/improvements
by stevieb
in thread PM module question/improvements
by perlynewby
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |