Package and test a reusable Perl module
8 steps · about 4 h 5 min · Intermediate
- Understand packages and module files (guide, Perl documentation, 25 min)
Start with the namespace and file conventions that make Perl code reusable.
- Model shared data with references (guide, Perl documentation, 25 min)
Use references deliberately before placing structured state behind an interface.
- Check reference behavior precisely (reference, Perl documentation, 30 min)
Confirm the dereferencing and lifetime rules the module will depend on.
- Define the object boundary (guide, Perl documentation, 35 min)
Choose a clear constructor and method contract without hiding Perl's underlying model.
- Build the first class implementation (tutorial, Perl documentation, 40 min)
Apply the object model to a small class whose public behavior can be tested.
- Lay out a distributable module (guide, Perl documentation, 35 min)
Put code, metadata and documentation where Perl tooling expects them.
- Write behavior-focused tests (reference, Perl documentation, 35 min)
Protect construction, valid calls and failure cases with readable assertions.
- Run the suite as a consumer would (guide, Perl documentation, 20 min)
Finish by running the distribution's tests through Perl's standard harness.