laziness, impatience, and hubris | |
PerlMonks |
Re: Factory classes in Perlby jszinger (Scribe) |
on Jan 11, 2021 at 19:24 UTC ( [id://11126761]=note: print w/replies, xml ) | Need Help?? |
Here’s how I use factories. I have a module which can generate graphics in several different formats (SVG, PDF, etc). I created an OutputRole and a separate class implementing that role for each format ('Output::SVG', etc). Then, when it is time to create output, the OutputFactory takes the name of the output format and returns the appropriate class.
In Section
Seekers of Perl Wisdom
|
|